gitlab-org--gitlab-foss/app/workers/issue_rebalancing_worker.rb

25 lines
671 B
Ruby

# frozen_string_literal: true
class IssueRebalancingWorker
include ApplicationWorker
sidekiq_options retry: 3
idempotent!
urgency :low
feature_category :issue_tracking
tags :exclude_from_kubernetes
def perform(ignore = nil, project_id = nil)
return if project_id.nil?
project = Project.find(project_id)
# All issues are equivalent as far as we are concerned
issue = project.issues.take # rubocop: disable CodeReuse/ActiveRecord
IssueRebalancingService.new(issue).execute
rescue ActiveRecord::RecordNotFound, IssueRebalancingService::TooManyIssues => e
Gitlab::ErrorTracking.log_exception(e, project_id: project_id)
end
end