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:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-09-22 16:34:54 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-10-07 10:13:38 +0300
commit1641ec51fbd5d18a367180a729a3bb5d6cd9dfba (patch)
treee68fd7b5607dc8c9496c3b6f7e8cae7dc743ec89
parent22351f97cb1da948d9acc0948a03174d34aa5d0d (diff)
supervisor: Stop monitor if shutdown was signalled
The supervisor's health monitor will check health every 15 seconds or alternatively exit if its shutdown channel was closed. While we do verify this channel correctly when trying to send the event, we do not check for shutdown when waiting 15 seconds for the next event. Fix this by returning early if we got the signal to shut down.
-rw-r--r--internal/supervisor/monitor.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/internal/supervisor/monitor.go b/internal/supervisor/monitor.go
index 08a112cd4..2e6a3dc71 100644
--- a/internal/supervisor/monitor.go
+++ b/internal/supervisor/monitor.go
@@ -93,6 +93,10 @@ func monitorHealth(f func() error, events chan<- Event, name string, shutdown <-
return
}
- time.Sleep(15 * time.Second)
+ select {
+ case <-shutdown:
+ return
+ case <-time.After(15 * time.Second):
+ }
}
}