diff options
author | Alessio Caiazza <acaiazza@gitlab.com> | 2019-04-08 12:54:50 +0300 |
---|---|---|
committer | Alessio Caiazza <acaiazza@gitlab.com> | 2019-04-08 12:55:06 +0300 |
commit | ea76de1576f47b498cc844e52291aec5878d74f4 (patch) | |
tree | b22bcbe7b8ee0b7b88c724d68edf31394c0da224 | |
parent | 924fd0a3419a2086ff24901938ed149c432920a5 (diff) |
avoid context.Context
-rw-r--r-- | cmd/gitaly/bootstrap.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/cmd/gitaly/bootstrap.go b/cmd/gitaly/bootstrap.go index 4ea0ec945..f2ad0c582 100644 --- a/cmd/gitaly/bootstrap.go +++ b/cmd/gitaly/bootstrap.go @@ -1,7 +1,6 @@ package main import ( - "context" "fmt" "net" "os" @@ -171,12 +170,10 @@ func (b *bootstrap) run() { func (b *bootstrap) waitGracePeriod(kill <-chan os.Signal) { log.WithField("graceful_restart_timeout", config.Config.GracefulRestartTimeout).Warn("starting grace period") - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - + allServersDone := make(chan struct{}) go func() { b.wg.Wait() - cancel() + close(allServersDone) }() select { @@ -184,7 +181,7 @@ func (b *bootstrap) waitGracePeriod(kill <-chan os.Signal) { log.Error("old process stuck on termination. Grace period expired.") case <-kill: log.Error("force shutdown") - case <-ctx.Done(): + case <-allServersDone: log.Info("graceful stop completed") } } |