Commit c3a1afa6 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'ajk-issue-reposition-take' into 'master'

Prefer take over first

See merge request gitlab-org/gitlab!43315
parents 13f53339 794c805e
...@@ -36,14 +36,14 @@ class IssuePlacementWorker ...@@ -36,14 +36,14 @@ class IssuePlacementWorker
Gitlab::ErrorTracking.log_exception(e, issue_id: issue_id, project_id: project_id) Gitlab::ErrorTracking.log_exception(e, issue_id: issue_id, project_id: project_id)
IssueRebalancingWorker.perform_async(nil, project_id.presence || issue.project_id) IssueRebalancingWorker.perform_async(nil, project_id.presence || issue.project_id)
end end
# rubocop: enable CodeReuse/ActiveRecord
def find_issue(issue_id, project_id) def find_issue(issue_id, project_id)
return Issue.id_in(issue_id).first if issue_id return Issue.id_in(issue_id).take if issue_id
project = Project.id_in(project_id).first project = Project.id_in(project_id).take
return unless project return unless project
project.issues.first project.issues.take
end end
# rubocop: enable CodeReuse/ActiveRecord
end end
...@@ -11,7 +11,8 @@ class IssueRebalancingWorker ...@@ -11,7 +11,8 @@ class IssueRebalancingWorker
return if project_id.nil? return if project_id.nil?
project = Project.find(project_id) project = Project.find(project_id)
issue = project.issues.first # All issues are equivalent as far as we are concerned # All issues are equivalent as far as we are concerned
issue = project.issues.take # rubocop: disable CodeReuse/ActiveRecord
IssueRebalancingService.new(issue).execute IssueRebalancingService.new(issue).execute
rescue ActiveRecord::RecordNotFound, IssueRebalancingService::TooManyIssues => e rescue ActiveRecord::RecordNotFound, IssueRebalancingService::TooManyIssues => e
......
---
title: Performance fix for issue placement
merge_request: 43315
author:
type: performance
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment