Commit b6c2cc36 authored by Alper Akgun's avatar Alper Akgun

Merge branch 'issue_243606-improve_epic_swimlanes_query' into 'master'

Improve epic swimlanes loading performance for group issue board

See merge request gitlab-org/gitlab!75378
parents dc54887d 42de05b8
...@@ -36,6 +36,7 @@ module Resolvers ...@@ -36,6 +36,7 @@ module Resolvers
list_service.execute.in_epics(accessible_epics).distinct_epic_ids list_service.execute.in_epics(accessible_epics).distinct_epic_ids
end end
# rubocop: disable CodeReuse/ActiveRecord
def accessible_epics def accessible_epics
EpicsFinder.new( EpicsFinder.new(
context[:current_user], context[:current_user],
...@@ -43,8 +44,9 @@ module Resolvers ...@@ -43,8 +44,9 @@ module Resolvers
state: :opened, state: :opened,
include_ancestor_groups: true, include_ancestor_groups: true,
include_descendant_groups: board.group_board? include_descendant_groups: board.group_board?
).execute ).execute.reorder(nil) # Not having order here increases performance, epics will be ordering on parent query anyway.
end end
# rubocop: enable CodeReuse/ActiveRecord
def group def group
board.project_board? ? board.project.group : board.group board.project_board? ? board.project.group : board.group
......
...@@ -64,7 +64,7 @@ RSpec.describe Resolvers::BoardGroupings::EpicsResolver do ...@@ -64,7 +64,7 @@ RSpec.describe Resolvers::BoardGroupings::EpicsResolver do
it 'finds all epics for issues in the group board' do it 'finds all epics for issues in the group board' do
result = resolve_board_epics(group_board) result = resolve_board_epics(group_board)
expect(result).to match_array([epic1, epic2, epic3]) expect(result).to eq([epic1, epic2, epic3])
end end
it 'finds only epics for issues matching issue filters' do it 'finds only epics for issues matching issue filters' do
......
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