Optimize list_refs usage by skipping unnecesary calls
What does this MR do and why?
Contributes to #556727 (closed)
Problem
New feature flag ref_existence_check_gitaly migrates reference
existance checks from Redis to Gitaly. But some endpoints generate
suboptimal chain of calls that lead to N+1 Gitaly calls.
Solution
- Skip the branch check for default branch
- Preload references for BranchesController
References
[FF] `ref_existence_check_gitaly` -- use Gitaly... (#556727 - closed)
How to set up and validate locally
- Enable feature flag
Feature.enable(:ref_existence_check_gitaly) - Visit http://gdk.test:3000/gitlab-org/gitlab-test/-/branches
- You should see only one
ListRefscall
| Before | After |
|---|---|
![]() |
![]() |
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #556727 (closed)
Edited by Vasilii Iakliushin

