summaryrefslogtreecommitdiff
path: root/app/uploaders/object_storage.rb
diff options
context:
space:
mode:
authorMicaël Bergeron <mbergeron@gitlab.com>2018-06-08 10:51:59 -0400
committerMicaël Bergeron <mbergeron@gitlab.com>2018-06-08 10:51:59 -0400
commite1589a5c584acae83d97d41494616be1f3981da7 (patch)
treee3241222ec597a912e6a7f14a0129af5e5bf3c20 /app/uploaders/object_storage.rb
parent50872bcc242a582c7e3af25df4d32e1c3e0a28f3 (diff)
downloadgitlab-ce-e1589a5c584acae83d97d41494616be1f3981da7.tar.gz
apply feedback
Diffstat (limited to 'app/uploaders/object_storage.rb')
-rw-r--r--app/uploaders/object_storage.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/app/uploaders/object_storage.rb b/app/uploaders/object_storage.rb
index bebaa3b807b..43c2b419332 100644
--- a/app/uploaders/object_storage.rb
+++ b/app/uploaders/object_storage.rb
@@ -9,7 +9,16 @@ module ObjectStorage
RemoteStoreError = Class.new(StandardError)
UnknownStoreError = Class.new(StandardError)
ObjectStorageUnavailable = Class.new(StandardError)
- ExclusiveLeaseTaken = Class.new(StandardError)
+
+ class ExclusiveLeaseTaken < StandardError
+ def initialize(lease_key)
+ @lease_key = lease_key
+ end
+
+ def message
+ "Exclusive lease #{@lease_key} already taken."
+ end
+ end
TMP_UPLOAD_PATH = 'tmp/uploads'.freeze
@@ -379,7 +388,7 @@ module ObjectStorage
def with_exclusive_lease
lease_key = exclusive_lease_key
uuid = Gitlab::ExclusiveLease.new(lease_key, timeout: 1.hour.to_i).try_obtain
- raise ExclusiveLeaseTaken, "Exclusive lease #{lease_key} already taken." unless uuid
+ raise ExclusiveLeaseTaken.new(lease_key) unless uuid
yield uuid
ensure