diff options
author | Sean McGivern <sean@gitlab.com> | 2018-08-21 12:56:01 +0100 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2018-08-21 12:58:32 +0100 |
commit | b26e5546c3a523742b39a0b5b0e376367ea4c649 (patch) | |
tree | 9d8496b43a4e95087d3ac50e5340916555350f75 /spec/services/issues | |
parent | 569069eed0957957f79c4fac29e3f07db94122e2 (diff) | |
download | gitlab-ce-b26e5546c3a523742b39a0b5b0e376367ea4c649.tar.gz |
Only load issue notes once when getting related MRs43096-controller-projects-issuescontroller-referenced_merge_requests-json-executes-more-than-100-sql-queries
As we always call both methods from the controller - and elsewhere we call the
more general method - and one uses all notes and the other uses system notes,
then we should just load the notes and their authors once, and filter on the
Ruby side.
Diffstat (limited to 'spec/services/issues')
-rw-r--r-- | spec/services/issues/referenced_merge_requests_service_spec.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/services/issues/referenced_merge_requests_service_spec.rb b/spec/services/issues/referenced_merge_requests_service_spec.rb index d57bcf55af1..61d1612829f 100644 --- a/spec/services/issues/referenced_merge_requests_service_spec.rb +++ b/spec/services/issues/referenced_merge_requests_service_spec.rb @@ -65,6 +65,12 @@ describe Issues::ReferencedMergeRequestsService do expect { service.execute(issue).each(&pipeline_routes) } .not_to exceed_query_limit(control_count) end + + it 'only loads issue notes once' do + expect(issue).to receive(:notes).once.and_call_original + + service.execute(issue) + end end end |