diff --git a/ee/app/services/ee/boards/issues/list_service.rb b/ee/app/services/ee/boards/issues/list_service.rb index 2a92c9d25447856044acbe437dfc7a644309d0cf..66e8fb686515627c9339da8024e1ca5b5d90af2a 100644 --- a/ee/app/services/ee/boards/issues/list_service.rb +++ b/ee/app/services/ee/boards/issues/list_service.rb @@ -60,8 +60,12 @@ def all_milestone_lists def without_assignees_from_lists(issues) return issues if all_assignee_lists.empty? - issues - .where.not(id: issues.joins(:assignees).where(users: { id: all_assignee_lists.select(:user_id) })) + matching_assignee = ::IssueAssignee + .where(user_id: all_assignee_lists.reorder(nil).select(:user_id)) + .where("issue_id = issues.id") + .select(1) + + issues.where('NOT EXISTS (?)', matching_assignee) end # rubocop: enable CodeReuse/ActiveRecord diff --git a/ee/changelogs/unreleased/speed-up-open-list-for-boards-with-assignee-lists.yml b/ee/changelogs/unreleased/speed-up-open-list-for-boards-with-assignee-lists.yml new file mode 100644 index 0000000000000000000000000000000000000000..9a4838fa80144c612b0b998011f3b4d92fb10920 --- /dev/null +++ b/ee/changelogs/unreleased/speed-up-open-list-for-boards-with-assignee-lists.yml @@ -0,0 +1,5 @@ +--- +title: Fix timeout loading Open list when board contains assignee lists +merge_request: +author: +type: performance