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-08 17:15:15 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-12-10 14:48:29 +0300
commit5bdd2aac3848c5a2c79f621fa229527bee8f8f21 (patch)
tree47f15be66b0e0ec724dc1f74b4406009420970f4 /cmd
parent33393ac28e10597b47d255f2708f115052be1063 (diff)
replicator: Use ticker to process stale jobs
The function which processes stale jobs takes a configurable duration for how often the monitoring loop should run. This makes it hard to control the ticker from the outside, most importantly in tests. Refactor the code to instead accept a ticker and amend tests to use a manual ticker to get rid of timeouts.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/praefect/main.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd/praefect/main.go b/cmd/praefect/main.go
index 8ba6acce8..56f56ab9a 100644
--- a/cmd/praefect/main.go
+++ b/cmd/praefect/main.go
@@ -463,8 +463,12 @@ func run(
}
go repl.ProcessBacklog(ctx, praefect.ExpBackoffFactory{Start: time.Second, Max: 5 * time.Second})
+
+ staleTicker := helper.NewTimerTicker(30 * time.Second)
+ defer staleTicker.Stop()
+
logger.Info("background started: processing of the replication events")
- repl.ProcessStale(ctx, 30*time.Second, time.Minute)
+ repl.ProcessStale(ctx, staleTicker, time.Minute)
logger.Info("background started: processing of the stale replication events")
if interval := conf.Reconciliation.SchedulingInterval.Duration(); interval > 0 {