Commit 53d1cae3 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'speed-up-open-list-for-boards-with-assignee-lists' into 'master'

Speed up Open list when there are assignee lists

Closes gitlab-ce#51184

See merge request gitlab-org/gitlab-ee!9090
parents e90ff461 934e065d
......@@ -60,8 +60,12 @@ module EE
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
......
---
title: Fix timeout loading Open list when board contains assignee lists
merge_request:
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