Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
44975f8a
Commit
44975f8a
authored
Jun 07, 2018
by
Micaël Bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shave off another 20% query
parent
38c2e480
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
app/uploaders/object_storage.rb
app/uploaders/object_storage.rb
+4
-3
app/uploaders/records_uploads.rb
app/uploaders/records_uploads.rb
+1
-1
spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb
...ers/workers/object_storage/migrate_uploads_worker_spec.rb
+1
-2
No files found.
app/uploaders/object_storage.rb
View file @
44975f8a
...
...
@@ -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
#
...
...
app/uploaders/records_uploads.rb
View file @
44975f8a
...
...
@@ -22,7 +22,7 @@ module RecordsUploads
Upload
.
transaction
do
uploads
.
where
(
path:
upload_path
).
delete_all
upload
.
de
stroy!
if
upload
upload
.
de
lete
if
upload
self
.
upload
=
build_upload
.
tap
(
&
:save!
)
end
...
...
spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb
View file @
44975f8a
require
'spec_helper'
MIGRATION_QUERIES
=
7
MIGRATION_QUERIES
=
5
describe
ObjectStorage
::
MigrateUploadsWorker
,
:sidekiq
do
shared_context
'sanity_check! fails'
do
...
...
@@ -14,7 +14,6 @@ describe ObjectStorage::MigrateUploadsWorker, :sidekiq do
let
(
:to_store
)
{
ObjectStorage
::
Store
::
REMOTE
}
def
perform
(
uploads
)
binding
.
pry
described_class
.
new
.
perform
(
uploads
.
ids
,
model_class
.
to_s
,
mounted_as
,
to_store
)
rescue
ObjectStorage
::
MigrateUploadsWorker
::
Report
::
MigrationFailures
# swallow
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment