summaryrefslogtreecommitdiff
path: root/app/uploaders/object_storage.rb
diff options
context:
space:
mode:
authorMicaël Bergeron <mbergeron@gitlab.com>2018-06-07 10:01:47 -0400
committerMicaël Bergeron <mbergeron@gitlab.com>2018-06-07 10:01:47 -0400
commit44975f8a5ad9c40c615f47f683fb46c94aa0e130 (patch)
tree0b1cc1830e84dfd3a77d916352a2c23cbbde5ab5 /app/uploaders/object_storage.rb
parent38c2e480bfa180241e94e77c049b1f5256d83bcf (diff)
downloadgitlab-ce-44975f8a5ad9c40c615f47f683fb46c94aa0e130.tar.gz
shave off another 20% query
Diffstat (limited to 'app/uploaders/object_storage.rb')
-rw-r--r--app/uploaders/object_storage.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/uploaders/object_storage.rb b/app/uploaders/object_storage.rb
index 3f5d0d200f4..bc8f1a5861a 100644
--- a/app/uploaders/object_storage.rb
+++ b/app/uploaders/object_storage.rb
@@ -376,12 +376,13 @@ module ObjectStorage
end
def with_exclusive_lease
- uuid = Gitlab::ExclusiveLease.new(exclusive_lease_key, timeout: 1.hour.to_i).try_obtain
- raise 'exclusive lease already taken' unless uuid
+ lease_key = exclusive_lease_key
+ uuid = Gitlab::ExclusiveLease.new(lease_key, timeout: 1.hour.to_i).try_obtain
+ raise "Exclusive lease #{lease_key} already taken." unless uuid
yield uuid
ensure
- Gitlab::ExclusiveLease.cancel(exclusive_lease_key, uuid)
+ Gitlab::ExclusiveLease.cancel(lease_key, uuid)
end
#