BranchesController#diverging_commit_counts N+1 Gitaly calls

As seen in #mech_symp_alerts (https://log.gitlab.net/goto/04e6c7e8aff31a33c4af6c71fce776d7), Projects::BranchesController#diverging_commit_counts has N+1 Gitaly calls.

lib/gitlab/gitaly_client/commit_service.rb:160:in `diverging_commit_count'
lib/gitlab/git/repository.rb:493:in `block in diverging_commit_count'
lib/gitlab/git/wraps_gitaly_errors.rb:7:in `wrapped_gitaly_errors'
lib/gitlab/git/repository.rb:492:in `diverging_commit_count'
app/services/branches/diverging_commit_counts_service.rb:24:in `block in diverging_commit_counts'
lib/gitlab/repository_cache.rb:24:in `fetch'
app/services/branches/diverging_commit_counts_service.rb:22:in `diverging_commit_counts'
app/services/branches/diverging_commit_counts_service.rb:11:in `call'
app/controllers/projects/branches_controller.rb:52:in `block (4 levels) in diverging_commit_counts'
app/controllers/projects/branches_controller.rb:52:in `map'
app/controllers/projects/branches_controller.rb:52:in `block (3 levels) in diverging_commit_counts'
lib/gitlab/gitaly_client.rb:284:in `allow_n_plus_1_calls'
app/controllers/projects/branches_controller.rb:51:in `block (2 levels) in diverging_commit_counts'
app/controllers/projects/branches_controller.rb:46:in `diverging_commit_counts'
ee/lib/gitlab/ip_address_state.rb:10:in `with'
Edited Aug 31, 2019 by Stan Hu
Assignee Loading
Time tracking Loading