Commit e4038cb5 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'cache-diff-size-limits' into 'master'

Only look up diff size limit flags once per request

See merge request !12048
parents 07e05c6f 9b42be02
...@@ -23,6 +23,23 @@ module Gitlab ...@@ -23,6 +23,23 @@ module Gitlab
class << self class << self
# The maximum size of a diff to display. # The maximum size of a diff to display.
def size_limit 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') if Feature.enabled?('gitlab_git_diff_size_limit_increase')
200.kilobytes 200.kilobytes
else else
...@@ -30,8 +47,7 @@ module Gitlab ...@@ -30,8 +47,7 @@ module Gitlab
end end
end end
# The maximum size before a diff is collapsed. def find_collapse_limit
def collapse_limit
if Feature.enabled?('gitlab_git_diff_size_limit_increase') if Feature.enabled?('gitlab_git_diff_size_limit_increase')
100.kilobytes 100.kilobytes
else else
......
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