2020-08-26 20:10:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class IssueRebalancingWorker
|
|
|
|
include ApplicationWorker
|
|
|
|
|
|
|
|
idempotent!
|
|
|
|
urgency :low
|
|
|
|
feature_category :issue_tracking
|
|
|
|
|
2020-09-01 05:10:28 -04:00
|
|
|
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
|
2020-08-26 20:10:33 -04:00
|
|
|
|
|
|
|
IssueRebalancingService.new(issue).execute
|
|
|
|
rescue ActiveRecord::RecordNotFound, IssueRebalancingService::TooManyIssues => e
|
2020-09-01 05:10:28 -04:00
|
|
|
Gitlab::ErrorTracking.log_exception(e, project_id: project_id)
|
2020-08-26 20:10:33 -04:00
|
|
|
end
|
|
|
|
end
|