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
3f6faae3
Commit
3f6faae3
authored
Mar 18, 2020
by
Robert May
Committed by
Stan Hu
Mar 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for empty keys on Redis#del
Prevents attempts to call Redis `del` with no arguments.
parent
59b731a5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
lib/gitlab/set_cache.rb
lib/gitlab/set_cache.rb
+3
-0
spec/lib/gitlab/repository_set_cache_spec.rb
spec/lib/gitlab/repository_set_cache_spec.rb
+6
-0
No files found.
lib/gitlab/set_cache.rb
View file @
3f6faae3
...
@@ -14,7 +14,10 @@ module Gitlab
...
@@ -14,7 +14,10 @@ module Gitlab
"
#{
key
}
:set"
"
#{
key
}
:set"
end
end
# Returns the number of keys deleted by Redis
def
expire
(
*
keys
)
def
expire
(
*
keys
)
return
0
if
keys
.
empty?
with
do
|
redis
|
with
do
|
redis
|
keys
=
keys
.
map
{
|
key
|
cache_key
(
key
)
}
keys
=
keys
.
map
{
|
key
|
cache_key
(
key
)
}
unlink_or_delete
(
redis
,
keys
)
unlink_or_delete
(
redis
,
keys
)
...
...
spec/lib/gitlab/repository_set_cache_spec.rb
View file @
3f6faae3
...
@@ -88,6 +88,12 @@ describe Gitlab::RepositorySetCache, :clean_gitlab_redis_cache do
...
@@ -88,6 +88,12 @@ describe Gitlab::RepositorySetCache, :clean_gitlab_redis_cache do
end
end
end
end
context
'no keys'
do
let
(
:keys
)
{
[]
}
it
{
is_expected
.
to
eq
(
0
)
}
end
context
"unlink isn't supported"
do
context
"unlink isn't supported"
do
before
do
before
do
allow_any_instance_of
(
Redis
).
to
receive
(
:unlink
)
{
raise
::
Redis
::
CommandError
}
allow_any_instance_of
(
Redis
).
to
receive
(
:unlink
)
{
raise
::
Redis
::
CommandError
}
...
...
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