diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-08 21:08:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-08 21:08:59 +0300 |
commit | 8b0d3151ae81cef695647771d1781c535d6f6cf5 (patch) | |
tree | f58d72ada21f6f7598a1e9f69fc80cdbbae8f2b6 /spec/tasks/cache_rake_spec.rb | |
parent | ec9dd96cd876d8778bb757a1e1e0252a58fdcbbb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/tasks/cache_rake_spec.rb')
-rw-r--r-- | spec/tasks/cache_rake_spec.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/spec/tasks/cache_rake_spec.rb b/spec/tasks/cache_rake_spec.rb index 375d01bf2ba..046f8b107f2 100644 --- a/spec/tasks/cache_rake_spec.rb +++ b/spec/tasks/cache_rake_spec.rb @@ -53,6 +53,12 @@ RSpec.describe 'clearing redis cache', :clean_gitlab_redis_repository_cache, :cl end def redis_keys - Gitlab::Redis::Cache.with { |redis| redis.scan(0, match: "*") }.last + # multiple scans to look across different shards if cache is using a Redis Cluster + cursor, scanned_keys = Gitlab::Redis::Cache.with { |redis| redis.scan(0, match: "*") } + while cursor != "0" + cursor, keys = Gitlab::Redis::Cache.with { |redis| redis.scan(cursor, match: "*") } + scanned_keys << keys + end + scanned_keys.flatten end end |