Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
bad4d4f4
Commit
bad4d4f4
authored
Mar 11, 2021
by
Vasilii Iakliushin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use different cache key when feature flag is enabled
parent
8a617d71
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
lib/gitlab/diff/highlight_cache.rb
lib/gitlab/diff/highlight_cache.rb
+6
-1
spec/lib/gitlab/diff/highlight_cache_spec.rb
spec/lib/gitlab/diff/highlight_cache_spec.rb
+11
-1
No files found.
lib/gitlab/diff/highlight_cache.rb
View file @
bad4d4f4
...
@@ -69,7 +69,12 @@ module Gitlab
...
@@ -69,7 +69,12 @@ module Gitlab
def
key
def
key
strong_memoize
(
:redis_key
)
do
strong_memoize
(
:redis_key
)
do
[
'highlighted-diff-files'
,
diffable
.
cache_key
,
VERSION
,
diff_options
].
join
(
":"
)
[
'highlighted-diff-files'
,
diffable
.
cache_key
,
VERSION
,
diff_options
,
Feature
.
enabled?
(
:introduce_marker_ranges
,
diffable
.
project
,
default_enabled: :yaml
)
].
join
(
":"
)
end
end
end
end
...
...
spec/lib/gitlab/diff/highlight_cache_spec.rb
View file @
bad4d4f4
...
@@ -238,7 +238,17 @@ RSpec.describe Gitlab::Diff::HighlightCache, :clean_gitlab_redis_cache do
...
@@ -238,7 +238,17 @@ RSpec.describe Gitlab::Diff::HighlightCache, :clean_gitlab_redis_cache do
subject
{
cache
.
key
}
subject
{
cache
.
key
}
it
'returns cache key'
do
it
'returns cache key'
do
is_expected
.
to
start_with
(
"highlighted-diff-files:
#{
cache
.
diffable
.
cache_key
}
:2"
)
is_expected
.
to
eq
(
"highlighted-diff-files:
#{
cache
.
diffable
.
cache_key
}
:2:
#{
cache
.
diff_options
}
:true"
)
end
context
'when feature flag is disabled'
do
before
do
stub_feature_flags
(
introduce_marker_ranges:
false
)
end
it
'returns the original version of the cache'
do
is_expected
.
to
eq
(
"highlighted-diff-files:
#{
cache
.
diffable
.
cache_key
}
:2:
#{
cache
.
diff_options
}
:false"
)
end
end
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment