summaryrefslogtreecommitdiff
path: root/lib/gitlab/exclusive_lease.rb
diff options
context:
space:
mode:
authorSteve Halasz <stevehalasz@gmail.com>2016-10-27 16:07:56 -0400
committerSteve Halasz <stevehalasz@gmail.com>2016-10-27 16:07:56 -0400
commit32e46d35024ec394e3513910c2dc65f98dedda5a (patch)
tree66a16f780d5697bfbba15a793d0d7c9939f60e62 /lib/gitlab/exclusive_lease.rb
parent47bda4f009a21be234d3f5a455933c98f4623b87 (diff)
parent85bd6296a72194f9d044829456616195765611c4 (diff)
downloadgitlab-ce-32e46d35024ec394e3513910c2dc65f98dedda5a.tar.gz
Merge branch 'master' into 5905-duplicate-email-errors
Getting latest CHANGELOG so I can resolve merge conflict
Diffstat (limited to 'lib/gitlab/exclusive_lease.rb')
-rw-r--r--lib/gitlab/exclusive_lease.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/gitlab/exclusive_lease.rb b/lib/gitlab/exclusive_lease.rb
index ffe49364379..7e8f35e9298 100644
--- a/lib/gitlab/exclusive_lease.rb
+++ b/lib/gitlab/exclusive_lease.rb
@@ -27,7 +27,7 @@ module Gitlab
# on begin/ensure blocks to cancel a lease, because the 'ensure' does
# not always run. Think of 'kill -9' from the Unicorn master for
# instance.
- #
+ #
# If you find that leases are getting in your way, ask yourself: would
# it be enough to lower the lease timeout? Another thing that might be
# appropriate is to only use a lease for bulk/automated operations, and
@@ -48,6 +48,13 @@ module Gitlab
end
end
+ # Returns true if the key for this lease is set.
+ def exists?
+ Gitlab::Redis.with do |redis|
+ redis.exists(redis_key)
+ end
+ end
+
# No #cancel method. See comments above!
private