Skip to content

"find_commit" Gitaly N+1 when fetching commit information on MR

We're currently having N+1 calls for Gitaly find_commit endpoint when presenting discussions:

Screen_Shot_2018-04-09_at_19.18.30

Steps to reproduce

  1. Create a MR
  2. Comment on a diff file
  3. Outdate this diff file (change it and push)
  4. You'll be able to see a new find_commit call for each new outdated file

Seems like we could be batching these requests using Gitlab::Git::Commit.batch_by_oid with BatchLoader, similarly as we lazy load Blobs.

Edited by Oswaldo Ferreira