diff options
author | John Cai <jcai@gitlab.com> | 2021-12-13 21:40:37 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2021-12-13 21:40:37 +0300 |
commit | bba495c8c929b75f8cbcdc6d07d07431736aa8d1 (patch) | |
tree | 425e786deee7b56bdfc7f9711ab053d98d56732b /cmd | |
parent | 15a1323ae16dffd3ba6b078f6cb81e283a96c72d (diff) | |
parent | 145fc5f58f6811b83b00e92ba755664b4278c6dd (diff) |
Merge branch 'pks-bootstrap-rewrite-tests' into 'master'
bootstrap: Rewrite tests to not use timeouts
See merge request gitlab-org/gitaly!4188
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/gitaly/main.go | 6 | ||||
-rw-r--r-- | cmd/praefect/main.go | 5 |
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) { |