diff options
-rw-r--r-- | daemon/daemon.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/daemon/daemon.go b/daemon/daemon.go index e885289..cf64a1f 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -54,7 +54,9 @@ func Run(cfg *config.Config, store *storage.Storage) { <-stop logger.Info("Shutting down the server...") - ctx, _ := context.WithTimeout(context.Background(), 5*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + server.Shutdown(ctx) store.Close() logger.Info("Server gracefully stopped") |