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
cff70753
Commit
cff70753
authored
Feb 16, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract lease timeout to a constant
parent
a3f1188e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
7 deletions
+5
-7
app/services/geo/repository_backfill_service.rb
app/services/geo/repository_backfill_service.rb
+3
-4
app/workers/geo_backfill_worker.rb
app/workers/geo_backfill_worker.rb
+2
-3
No files found.
app/services/geo/repository_backfill_service.rb
View file @
cff70753
...
...
@@ -2,6 +2,8 @@ module Geo
class
RepositoryBackfillService
attr_reader
:project
LEASE_TIMEOUT
=
24
.
hours
.
freeze
def
initialize
(
project
)
@project
=
project
end
...
...
@@ -40,10 +42,7 @@ module Geo
end
def
try_obtain_lease
uuid
=
Gitlab
::
ExclusiveLease
.
new
(
lease_key
,
timeout:
24
.
hours
).
try_obtain
uuid
=
Gitlab
::
ExclusiveLease
.
new
(
lease_key
,
timeout:
LEASE_TIMEOUT
).
try_obtain
return
unless
uuid
...
...
app/workers/geo_backfill_worker.rb
View file @
cff70753
...
...
@@ -3,7 +3,7 @@ class GeoBackfillWorker
include
CronjobQueue
LEASE_TIMEOUT
=
24
.
hours
.
freeze
RUN_TIME
=
5
.
minutes
.
to_i
.
freeze
RUN_TIME
=
5
.
minutes
.
to_i
.
freeze
def
perform
start
=
Time
.
now
...
...
@@ -32,8 +32,7 @@ class GeoBackfillWorker
end
def
try_obtain_lease
uuid
=
Gitlab
::
ExclusiveLease
.
new
(
lease_key
,
timeout:
LEASE_TIMEOUT
)
.
try_obtain
uuid
=
Gitlab
::
ExclusiveLease
.
new
(
lease_key
,
timeout:
LEASE_TIMEOUT
).
try_obtain
return
unless
uuid
...
...
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