summaryrefslogtreecommitdiff
path: root/app/workers/projects
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-12-10 15:10:24 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-12-10 15:10:24 +0000
commitecc11e5d608ff4393fb6c44d02416569e7d2785d (patch)
treed6e2921cf11f525d8fd7bbbab213684983dba0cf /app/workers/projects
parente838c62efb5d95fe76b5bbb6cba8b73c40eb2008 (diff)
downloadgitlab-ce-ecc11e5d608ff4393fb6c44d02416569e7d2785d.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/workers/projects')
-rw-r--r--app/workers/projects/process_sync_events_worker.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/workers/projects/process_sync_events_worker.rb b/app/workers/projects/process_sync_events_worker.rb
new file mode 100644
index 00000000000..b7c4b4de3d0
--- /dev/null
+++ b/app/workers/projects/process_sync_events_worker.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+module Projects
+ # This worker can be called multiple times at the same time but only one of them can
+ # process events at a time. This is ensured by `try_obtain_lease` in `Ci::ProcessSyncEventsService`.
+ # `until_executing` here is to reduce redundant worker enqueuing.
+ class ProcessSyncEventsWorker
+ include ApplicationWorker
+
+ data_consistency :always
+
+ feature_category :sharding
+ urgency :high
+
+ idempotent!
+ deduplicate :until_executing
+
+ def perform
+ ::Ci::ProcessSyncEventsService.new(::Projects::SyncEvent, ::Ci::ProjectMirror).execute
+ end
+ end
+end