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
path: root/cmd
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-12-10 13:53:07 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-12-13 13:23:24 +0300
commit145fc5f58f6811b83b00e92ba755664b4278c6dd (patch)
treeca388c3ce1346f9d1efa9e96671e289f084f304d /cmd
parent481c31d92f1670eacd02bad898d1e6d7d8a0f2c1 (diff)
bootstrap: Use ticker to get rid of test timeouts
The bootstrapping tests still need to use timeouts because of the grace period, which is the duration we give the server to exit before we force the upgrade. Convert the interface to instead accept tickers such that we can get rid of using timeouts in our tests.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gitaly/main.go6
-rw-r--r--cmd/praefect/main.go5
2 files changed, 9 insertions, 2 deletions
diff --git a/cmd/gitaly/main.go b/cmd/gitaly/main.go
index db7c73a06..1571c1d73 100644
--- a/cmd/gitaly/main.go
+++ b/cmd/gitaly/main.go
@@ -29,6 +29,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/storage"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/transaction"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitlab"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/helper"
glog "gitlab.com/gitlab-org/gitaly/v14/internal/log"
"gitlab.com/gitlab-org/gitaly/v14/internal/streamcache"
"gitlab.com/gitlab-org/gitaly/v14/internal/tempdir"
@@ -301,5 +302,8 @@ func run(cfg config.Cfg) error {
}
}()
- return b.Wait(cfg.GracefulRestartTimeout.Duration(), gitalyServerFactory.GracefulStop)
+ gracefulStopTicker := helper.NewTimerTicker(cfg.GracefulRestartTimeout.Duration())
+ defer gracefulStopTicker.Stop()
+
+ return b.Wait(gracefulStopTicker, gitalyServerFactory.GracefulStop)
}
diff --git a/cmd/praefect/main.go b/cmd/praefect/main.go
index 56f56ab9a..d444aff88 100644
--- a/cmd/praefect/main.go
+++ b/cmd/praefect/main.go
@@ -514,7 +514,10 @@ func run(
logger.Warn(`Repository cleanup background task disabled as "repositories_cleanup.run_interval" is not set or 0.`)
}
- return b.Wait(conf.GracefulStopTimeout.Duration(), srvFactory.GracefulStop)
+ gracefulStopTicker := helper.NewTimerTicker(conf.GracefulStopTimeout.Duration())
+ defer gracefulStopTicker.Stop()
+
+ return b.Wait(gracefulStopTicker, srvFactory.GracefulStop)
}
func getStarterConfigs(conf config.Config) ([]starter.Config, error) {