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:
authorMicaël Bergeron <mbergeron@gitlab.com>2018-06-07 17:01:47 +0300
committerMicaël Bergeron <mbergeron@gitlab.com>2018-06-07 17:01:47 +0300
commit44975f8a5ad9c40c615f47f683fb46c94aa0e130 (patch)
tree0b1cc1830e84dfd3a77d916352a2c23cbbde5ab5 /app/uploaders
parent38c2e480bfa180241e94e77c049b1f5256d83bcf (diff)
shave off another 20% query
Diffstat (limited to 'app/uploaders')
-rw-r--r--app/uploaders/object_storage.rb7
-rw-r--r--app/uploaders/records_uploads.rb2
2 files changed, 5 insertions, 4 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
#
diff --git a/app/uploaders/records_uploads.rb b/app/uploaders/records_uploads.rb
index 89c74a78835..301f4681fcd 100644
--- a/app/uploaders/records_uploads.rb
+++ b/app/uploaders/records_uploads.rb
@@ -22,7 +22,7 @@ module RecordsUploads
Upload.transaction do
uploads.where(path: upload_path).delete_all
- upload.destroy! if upload
+ upload.delete if upload
self.upload = build_upload.tap(&:save!)
end