Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessio Caiazza <acaiazza@gitlab.com>2019-04-08 12:54:50 +0300
committerAlessio Caiazza <acaiazza@gitlab.com>2019-04-08 12:55:06 +0300
commitea76de1576f47b498cc844e52291aec5878d74f4 (patch)
treeb22bcbe7b8ee0b7b88c724d68edf31394c0da224
parent924fd0a3419a2086ff24901938ed149c432920a5 (diff)
avoid context.Context
-rw-r--r--cmd/gitaly/bootstrap.go9
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")
}
}