Excessive calls to Gitaly when certain compliance settings enabled

Problem to solve

As described in a gl-infra issue, MR !46637 (merged) exposed a problem (and was therefore reverted). The problem is that the Project's "merge request index" page makes excessive calls to Gitaly when Gitlab::CurrentSettings.prevent_merge_requests_committers_approval is enabled.

Steps to reproduce

The steps for reproducing the issue are listed in this comment.

Proposal

Modify the behavior of Gitlab::CurrentSettings.prevent_merge_requests_committers_approval so it does not make excessive calls to Gitaly.

Possible solutions:

  • Store committer emails in GitLab.
  • Pre-calculate the number of approval left when approval rules change or new commits are added.

Notes

Sequence diagram
Edited by 🤖 GitLab Bot 🤖