Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/workers/issues/reschedule_stuck_issue_rebalances_worker.rb')
-rw-r--r--app/workers/issues/reschedule_stuck_issue_rebalances_worker.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/app/workers/issues/reschedule_stuck_issue_rebalances_worker.rb b/app/workers/issues/reschedule_stuck_issue_rebalances_worker.rb
new file mode 100644
index 00000000000..d1759589cc0
--- /dev/null
+++ b/app/workers/issues/reschedule_stuck_issue_rebalances_worker.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+module Issues
+ class RescheduleStuckIssueRebalancesWorker
+ include ApplicationWorker
+ include CronjobQueue
+
+ data_consistency :sticky
+
+ idempotent!
+ urgency :low
+ feature_category :team_planning
+ deduplicate :until_executed, including_scheduled: true
+
+ def perform
+ namespace_ids, project_ids = ::Gitlab::Issues::Rebalancing::State.fetch_rebalancing_groups_and_projects
+
+ return if namespace_ids.blank? && project_ids.blank?
+
+ namespaces = Namespace.id_in(namespace_ids)
+ projects = Project.id_in(project_ids)
+
+ IssueRebalancingWorker.bulk_perform_async_with_contexts(
+ namespaces,
+ arguments_proc: -> (namespace) { [nil, nil, namespace.id] },
+ context_proc: -> (namespace) { { namespace: namespace } }
+ )
+
+ IssueRebalancingWorker.bulk_perform_async_with_contexts(
+ projects,
+ arguments_proc: -> (project) { [nil, project.id, nil] },
+ context_proc: -> (project) { { project: project } }
+ )
+ end
+ end
+end