summaryrefslogtreecommitdiff
path: root/app/workers/issue_rebalancing_worker.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/workers/issue_rebalancing_worker.rb')
-rw-r--r--app/workers/issue_rebalancing_worker.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/workers/issue_rebalancing_worker.rb b/app/workers/issue_rebalancing_worker.rb
new file mode 100644
index 00000000000..032ba5534e6
--- /dev/null
+++ b/app/workers/issue_rebalancing_worker.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class IssueRebalancingWorker
+ include ApplicationWorker
+
+ idempotent!
+ urgency :low
+ feature_category :issue_tracking
+
+ def perform(ignore = nil, project_id = nil)
+ return if project_id.nil?
+
+ project = Project.find(project_id)
+ issue = project.issues.first # All issues are equivalent as far as we are concerned
+
+ IssueRebalancingService.new(issue).execute
+ rescue ActiveRecord::RecordNotFound, IssueRebalancingService::TooManyIssues => e
+ Gitlab::ErrorTracking.log_exception(e, project_id: project_id)
+ end
+end