Commit 42de05b8 authored by Felipe Artur's avatar Felipe Artur

Improve epic swimlanes query performance for group board

Optmize query to load epics swimlanes on group
issue boards.

Changelog: performance
EE: true
parent 6d3ce34e
......@@ -36,6 +36,7 @@ module Resolvers
list_service.execute.in_epics(accessible_epics).distinct_epic_ids
end
# rubocop: disable CodeReuse/ActiveRecord
def accessible_epics
EpicsFinder.new(
context[:current_user],
......@@ -43,8 +44,9 @@ module Resolvers
state: :opened,
include_ancestor_groups: true,
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
# rubocop: enable CodeReuse/ActiveRecord
def group
board.project_board? ? board.project.group : board.group
......
......@@ -64,7 +64,7 @@ RSpec.describe Resolvers::BoardGroupings::EpicsResolver do
it 'finds all epics for issues in the group board' do
result = resolve_board_epics(group_board)
expect(result).to match_array([epic1, epic2, epic3])
expect(result).to eq([epic1, epic2, epic3])
end
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