Provide limit to Gitaly for "Get references a commit is pushed to" API

What does this MR do and why?

Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/366829

Problem

The call to Gitaly is suboptimal because it doesn't set a limit of requested references.

Solution

Provide a limit to Gitaly RPC to fetch only requested references.

The limit is dynamically calculated to ensure that we request only necessary minimum of references.

References

https://gitlab.com/gitlab-org/gitlab/-/issues/366829

How to set up and validate locally

  1. Visit http://gdk.test:3000/api/v4/projects/gitlab-org%2Fgitlab-test/repository/commits/HEAD/refs?per_page=5&page=2
  2. Modify per_page and page values to ensure that pagination still works

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 #366829

Edited by Vasilii Iakliushin

Merge request reports

Loading