Performance regression when loading a merged MR from a project with a large fork network
!55970 (merged) added a feature-flagged feature to cherry pick an MR across forks.
Even with the feature flag disabled, cherry_pick_projects_data(@project).to_json
is still called in https://gitlab.com/gitlab-org/gitlab/blob/107b28be608292c6a55fbac8139c8eea48948ee8/app/views/projects/commit/_change.html.haml#L27.
And this triggers a several slow queries with a huge number of IDs. It even triggers loading of all avatars of all these forks due to the after_initialize :add_avatar_to_batch
that we do when we initialize a Project
.
I think we should consider moving this to an AJAX request that happens only after clicking the Revert button?
The :add_avatar_to_batch
is also another quirk. I'll create another issue for that. #325227
To reproduce
- Enable the performance bar
- Open a merged MR in the
gitlab-org/gitlab
project - You should see the DB queries being made
Edited by Heinrich Lee Yu