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:
authorJohn Cai <jcai@gitlab.com>2021-12-15 18:32:11 +0300
committerJohn Cai <jcai@gitlab.com>2021-12-15 18:32:11 +0300
commit2543b8f5543c5ded5829c6a201584b25fb0f19e7 (patch)
tree060361e7ec0ddf68e23c5aea9762c6795a22c005
parent100d3549f7d8b09c49e50342645de2a1305f19e0 (diff)
gitaly/main: Add background goroutine to setup cgroupsjc-degraded-cgroups
In the previous commit we allow Gitaly startup to continue as normal even if cgroups fail to setup. Most of the time this will be because on a restart, the cgroup root hasn't been setup yet. This commit adds a background task that continues to try to setup the cgroups on an interval. This would allow the cgroup root to be setup after Gitaly starts up, instead of requiring another restart for cgroups to come into use. Changelog: changed
-rw-r--r--cmd/gitaly/main.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/cmd/gitaly/main.go b/cmd/gitaly/main.go
index 85e2a823f..d62f9fc9c 100644
--- a/cmd/gitaly/main.go
+++ b/cmd/gitaly/main.go
@@ -100,6 +100,21 @@ func configure(configPath string) (config.Cfg, error) {
if err := cgroups.NewManager(cfg.Cgroups).Setup(); err != nil {
log.WithError(err).Error("failed setting up cgroups")
+ go func() {
+ ticker := time.NewTicker(5 * time.Minute)
+ defer ticker.Stop()
+
+ for {
+ <-ticker.C
+ log.Info("attempting to setup cgroups")
+
+ if err := cgroups.NewManager(cfg.Cgroups).Setup(); err != nil {
+ log.WithError(err).Error("failed setting up cgroups")
+ } else {
+ break
+ }
+ }
+ }()
}
if err := verifyGitVersion(cfg); err != nil {