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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
06629cc6
Commit
06629cc6
authored
May 03, 2019
by
Andreas Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always cancel the lease
parent
ec30d98a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
ee/app/workers/update_all_mirrors_worker.rb
ee/app/workers/update_all_mirrors_worker.rb
+11
-6
No files found.
ee/app/workers/update_all_mirrors_worker.rb
View file @
06629cc6
...
...
@@ -9,12 +9,9 @@ class UpdateAllMirrorsWorker
LEASE_KEY
=
'update_all_mirrors'
.
freeze
def
perform
lease_uuid
=
try_obtain_lease
return
unless
lease_uuid
schedule_mirrors!
cancel_lease
(
lease_uuid
)
with_lease
do
schedule_mirrors!
end
end
# rubocop: disable CodeReuse/ActiveRecord
...
...
@@ -49,6 +46,14 @@ class UpdateAllMirrorsWorker
private
def
with_lease
if
lease_uuid
=
try_obtain_lease
yield
end
ensure
cancel_lease
(
lease_uuid
)
if
lease_uuid
end
def
try_obtain_lease
::
Gitlab
::
ExclusiveLease
.
new
(
LEASE_KEY
,
timeout:
LEASE_TIMEOUT
).
try_obtain
end
...
...
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