From ed3ddbd710eb736ea058953b95c2bb5d651aead5 Mon Sep 17 00:00:00 2001 From: DarthSim Date: Tue, 4 Feb 2020 16:18:09 +0600 Subject: [PATCH] defer shutdown --- main.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index f1d17dbb..2c2faea6 100644 --- a/main.go +++ b/main.go @@ -32,6 +32,7 @@ func initialize() { func main() { initialize() + defer shutdownVips() go func() { var logMemStats = len(os.Getenv("IMGPROXY_LOG_MEM_STATS")) > 0 @@ -48,12 +49,10 @@ func main() { }() s := startServer() + defer shutdownServer(s) stop := make(chan os.Signal, 1) signal.Notify(stop, syscall.SIGINT, syscall.SIGTERM) <-stop - - shutdownServer(s) - shutdownVips() }