Redis N+1 in /api/v4/groups/:id/projects - exists? and has_visible_content?
Issue that derives from #214510 (closed)
Redis keys
cache:gitlab:exists?:$PATTERN
cache:gitlab:has_visible_content?:$PATTERN
cache:gitlab:root_ref:$PATTERN
cache:gitlab:readme_path:$PATTERN
are called in the loop while calling the api endpoint /api/v4/groups/:id/projects
. Those keys are called from this class: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/repository.rb
For example exists?
key and has_visible_content?
are called here: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/repository.rb#L524
I wonder how we can effectively refactor it to reduce redis calls.