Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-04-09 15:41:55 +0300
committerLin Jen-Shin <godfat@godfat.org>2018-04-10 15:57:00 +0300
commit4b30aec0aa9e52d3d7d4394f05a725d14e0c0db3 (patch)
tree7fc3713103151a70d08404fa0b48a49b25dfa026 /lib/tasks/cache.rake
parentde36ca81d35992c265cd4fd09c774cb793dbd246 (diff)
Allow `rake cache:clear` clearing pipeline status cache
* Use the correct key prefix * Clear old cache keys TODO: At some point we could remove clearing old cache keys.
Diffstat (limited to 'lib/tasks/cache.rake')
-rw-r--r--lib/tasks/cache.rake23
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