diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-04-17 06:07:56 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-04-17 06:07:56 +0300 |
commit | 23634e45678b13954fc00fd4e57425ff5cb559aa (patch) | |
tree | 636a39d3306c664d25df413f8e6c329fcf3a8fea /lib/tasks | |
parent | 76485cbf8ba555c929fd2f54ca2051a382760f20 (diff) | |
parent | c39ad568e469b288a510c03b1aebefd78d8a9ee5 (diff) |
Merge branch 'master' into live-trace-v2
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/cache.rake | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/tasks/cache.rake b/lib/tasks/cache.rake index 564aa141952..cb4d5abffbc 100644 --- a/lib/tasks/cache.rake +++ b/lib/tasks/cache.rake @@ -6,17 +6,22 @@ namespace :cache do desc "GitLab | Clear redis cache" task redis: :environment do Gitlab::Redis::Cache.with do |redis| - cursor = REDIS_SCAN_START_STOP - loop do - cursor, keys = redis.scan( - cursor, - match: "#{Gitlab::Redis::Cache::CACHE_NAMESPACE}*", - count: REDIS_CLEAR_BATCH_SIZE - ) + cache_key_pattern = %W[#{Gitlab::Redis::Cache::CACHE_NAMESPACE}* + projects/*/pipeline_status] - redis.del(*keys) if keys.any? + cache_key_pattern.each do |match| + cursor = REDIS_SCAN_START_STOP + loop do + cursor, keys = redis.scan( + cursor, + match: match, + count: REDIS_CLEAR_BATCH_SIZE + ) - break if cursor == REDIS_SCAN_START_STOP + redis.del(*keys) if keys.any? + + break if cursor == REDIS_SCAN_START_STOP + end end end end |