diff options
author | Frédéric Guillot <fred@miniflux.net> | 2018-04-17 21:50:52 -0700 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2018-04-17 21:50:52 -0700 |
commit | 657e96e13342a9fe968bad3fb752ad72271f2484 (patch) | |
tree | 556f6ee6c8db80aacd9ad0b7776ba312184c3527 /daemon | |
parent | 0429bbb19db777bf5979df02ab21815b33541e7e (diff) |
Improve graceful shutdown
Diffstat (limited to 'daemon')
-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") |