Commit c3588bd6 authored by Stan Hu's avatar Stan Hu

Enable ref name caching for merge request diffs

In one example, we found
`Projects::MergeRequests::DiffsController#diffs_metadata` calling Gitaly
over 3000 times with the same ref name for FindCommit. Since all actions
in this controller are GET requests, it should be safe to enable this
for all actions inside `DiffsController`, just as we do with
`CommitsController`.

Closes https://gitlab.com/gitlab-org/gitlab/-/issues/217192
parent 84046205
...@@ -9,6 +9,8 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic ...@@ -9,6 +9,8 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic
before_action :define_diff_vars before_action :define_diff_vars
before_action :define_diff_comment_vars, except: [:diffs_batch, :diffs_metadata] before_action :define_diff_comment_vars, except: [:diffs_batch, :diffs_metadata]
around_action :allow_gitaly_ref_name_caching
def show def show
render_diffs render_diffs
end end
......
---
title: Enable ref name caching for merge request diffs
merge_request: 31530
author:
type: performance
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment