mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-10-10 12:12:40 +02:00
Graceful shut down server and vips
This commit is contained in:
19
shutdown.go
Normal file
19
shutdown.go
Normal file
@@ -0,0 +1,19 @@
|
||||
// +build go1.8
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
func shutdownServer(s *http.Server) {
|
||||
log.Println("Shutting down the server...")
|
||||
|
||||
ctx, close := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer close()
|
||||
|
||||
s.Shutdown(ctx)
|
||||
}
|
Reference in New Issue
Block a user