Cache diff related data from blobs when loading "/diffs"
As explained on https://gitlab.com/gitlab-org/gitlab-ce/issues/44565#note_69389689, we need to fetch blobs information on Gitaly to present the Changes
tab information. There are two main scenarios (AFAIK) that we need this information:
- Highlight content; which is cached, then it's not needed until someone updates the MR
- Know which viewer should be used to render the diff file
And as also mentioned on https://gitlab.com/gitlab-org/gitlab-ce/issues/44565#note_69389689, it's pretty expensive depending on the amount of changed files / blob sizes in a MR.
Not fetching the blobs in a 20 changed files MR reduced the loading time in more than 100% (forced DiffViewer::Text
usage).
Proposal
This may require further investigation, but seems like we could initially be persisting the viewer
data on Redis and stop fetching blobs in every /diffs
request. As on diff highlight caching, we can expire it upon diff reload.
cc @smcgivern