summaryrefslogtreecommitdiff
path: root/app/workers/issue_rebalancing_worker.rb
blob: 032ba5534e60610ae9f7f099505c0850b393a281 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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