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
3a79fb87
Commit
3a79fb87
authored
Dec 09, 2019
by
Kerri Miller
Committed by
Grzegorz Bizon
Dec 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Force clearing of deprecated cache key
.
parent
5feebcca
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
lib/gitlab/diff/highlight_cache.rb
lib/gitlab/diff/highlight_cache.rb
+13
-0
spec/lib/gitlab/diff/highlight_cache_spec.rb
spec/lib/gitlab/diff/highlight_cache_spec.rb
+10
-0
No files found.
lib/gitlab/diff/highlight_cache.rb
View file @
3a79fb87
...
...
@@ -54,6 +54,15 @@ module Gitlab
private
# We create a Gitlab::Diff::DeprecatedHighlightCache here in order to
# expire deprecated cache entries while we make the transition. This can
# be removed when :hset_redis_diff_caching is fully launched.
# See https://gitlab.com/gitlab-org/gitlab/issues/38008
#
def
deprecated_cache
@deprecated_cache
||=
Gitlab
::
Diff
::
DeprecatedHighlightCache
.
new
(
@diff_collection
)
end
def
uncached_files
diff_files
=
@diff_collection
.
diff_files
...
...
@@ -85,6 +94,10 @@ module Gitlab
redis
.
expire
(
key
,
EXPIRATION
)
end
end
# Clean up any deprecated hash entries
#
deprecated_cache
.
clear
end
def
file_paths
...
...
spec/lib/gitlab/diff/highlight_cache_spec.rb
View file @
3a79fb87
...
...
@@ -98,6 +98,16 @@ describe Gitlab::Diff::HighlightCache, :clean_gitlab_redis_cache do
expect
{
cache
.
send
(
:write_to_redis_hash
,
diff_hash
)
}
.
to
change
{
Gitlab
::
Redis
::
Cache
.
with
{
|
r
|
r
.
hgetall
(
cache_key
)
}
}
end
# Note that this spec and the code it confirms can be removed when
# :hset_redis_diff_caching is fully launched.
#
it
'attempts to clear deprecated cache entries'
do
expect_any_instance_of
(
Gitlab
::
Diff
::
DeprecatedHighlightCache
)
.
to
receive
(
:clear
).
and_call_original
cache
.
send
(
:write_to_redis_hash
,
diff_hash
)
end
end
describe
'#clear'
do
...
...
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