diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-08 18:10:32 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-08 18:10:32 +0300 |
commit | 3de2ce7c6b536d63ea2f93239022eb51fa9241c1 (patch) | |
tree | ac66971b2cb57f1b24f1f03879abf9b27398fa10 /lib/gitlab | |
parent | 61cf5b32c5a6a3982a704d33e72ea9b391a3b04d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/diff/highlight_cache.rb | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/lib/gitlab/diff/highlight_cache.rb b/lib/gitlab/diff/highlight_cache.rb index 88f396fa7b9..7cfe0086f57 100644 --- a/lib/gitlab/diff/highlight_cache.rb +++ b/lib/gitlab/diff/highlight_cache.rb @@ -7,7 +7,6 @@ module Gitlab include Gitlab::Utils::StrongMemoize EXPIRATION = 1.day - PREVIOUS_EXPIRATION_PERIOD = 7.days VERSION = 2 delegate :diffable, to: :@diff_collection @@ -75,28 +74,14 @@ module Gitlab Feature.enabled?(:use_marker_ranges, diffable.project), Feature.enabled?(:diff_line_syntax_highlighting, diffable.project) ] + options_for_key = OpenSSL::Digest::SHA256.hexdigest(options.join) - options_for_key = - if Feature.enabled?(:highlight_diffs_optimize_memory_usage, diffable.project) - [OpenSSL::Digest::SHA256.hexdigest(options.join)] - else - options - end - - ['highlighted-diff-files', diffable.cache_key, VERSION, *options_for_key].join(":") + ['highlighted-diff-files', diffable.cache_key, VERSION, options_for_key].join(":") end end private - def expiration_period - if Feature.enabled?(:highlight_diffs_optimize_memory_usage, diffable.project) - EXPIRATION - else - PREVIOUS_EXPIRATION_PERIOD - end - end - def set_highlighted_diff_lines(diff_file, content) diff_file.highlighted_diff_lines = content.map do |line| Gitlab::Diff::Line.safe_init_from_hash(line) @@ -153,7 +138,7 @@ module Gitlab # HSETs have to have their expiration date manually updated # - redis.expire(key, expiration_period) + redis.expire(key, EXPIRATION) end record_memory_usage(fetch_memory_usage(redis, key)) |