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:
authorGabriel Mazetto <gabriel@gitlab.com>2018-03-09 16:32:18 +0300
committerNick Thomas <nick@gitlab.com>2018-03-09 16:32:18 +0300
commit9b5e4ecc55e85304c0eb3e9d3713edbc9bebbeab (patch)
tree4128cd28482de9646a26e8987d0af6c0a10865e6 /lib/gitlab/exclusive_lease.rb
parentcd7fcfd5779716c302608ce462996809f952ceec (diff)
Add rake task to cleanup any existing exclusive lease
Diffstat (limited to 'lib/gitlab/exclusive_lease.rb')
-rw-r--r--lib/gitlab/exclusive_lease.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/gitlab/exclusive_lease.rb b/lib/gitlab/exclusive_lease.rb
index dbb8f317afe..12b5e240962 100644
--- a/lib/gitlab/exclusive_lease.rb
+++ b/lib/gitlab/exclusive_lease.rb
@@ -41,6 +41,16 @@ module Gitlab
"gitlab:exclusive_lease:#{key}"
end
+ # Removes any existing exclusive_lease from redis
+ # Don't run this in a live system without making sure no one is using the leases
+ def self.reset_all!(scope = '*')
+ Gitlab::Redis::SharedState.with do |redis|
+ redis.scan_each(match: redis_shared_state_key(scope)).each do |key|
+ redis.del(key)
+ end
+ end
+ end
+
def initialize(key, uuid: nil, timeout:)
@redis_shared_state_key = self.class.redis_shared_state_key(key)
@timeout = timeout