Skip to content

MergeRequest Notes API Slow for Large Notes

Summary

MergeRequest Notes API poor performance on large notes, when compared to UI performance.

This was discovered when wondering why one of our merge-request check bots was timing out on certain merge requests. The use case of what triggers this is that a branch was created as a hotfix into a previous release, but then determined not to be a hotfix, and rebased and retargeted into master (in that specific order of actions).

Steps to reproduce

Create a new branch from target, add a couple commits to new. Create an MR from new to target. Rebase new such that it has a few (2+) thousand commits that aren't in target. Force push new.

Example Project

Example MR
Example MR API call

What is the current bug behavior?

The API request can take tens of seconds, whereas the UI seems to load the same data "quickly" (less than three seconds).

What is the expected correct behavior?

API call should be no slower than the UI call.

Output of checks

This bug happens on GitLab.com, as well as on our self-hosted instance.

Edited by 🤖 GitLab Bot 🤖