diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-06-09 23:16:58 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-06-09 23:16:58 +0300 |
commit | e4038cb5085522cfc648e78d105ed27b79c131a8 (patch) | |
tree | 67164ae4e472a679105e4e50a5c90738ab87d916 /lib/gitlab | |
parent | 07e05c6f0bea9821951217d6dd82d6dd014d773a (diff) | |
parent | 9b42be02abfe7066963cb29e3271b2c2ec415354 (diff) |
Merge branch 'cache-diff-size-limits' into 'master'
Only look up diff size limit flags once per request
See merge request !12048
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/git/diff.rb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/gitlab/git/diff.rb b/lib/gitlab/git/diff.rb index 8926aa19925..88ad760bea3 100644 --- a/lib/gitlab/git/diff.rb +++ b/lib/gitlab/git/diff.rb @@ -23,6 +23,23 @@ module Gitlab class << self # The maximum size of a diff to display. def size_limit + if RequestStore.active? + RequestStore['gitlab_git_diff_size_limit'] ||= find_size_limit + else + find_size_limit + end + end + + # The maximum size before a diff is collapsed. + def collapse_limit + if RequestStore.active? + RequestStore['gitlab_git_diff_collapse_limit'] ||= find_collapse_limit + else + find_collapse_limit + end + end + + def find_size_limit if Feature.enabled?('gitlab_git_diff_size_limit_increase') 200.kilobytes else @@ -30,8 +47,7 @@ module Gitlab end end - # The maximum size before a diff is collapsed. - def collapse_limit + def find_collapse_limit if Feature.enabled?('gitlab_git_diff_size_limit_increase') 100.kilobytes else |