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
Tatuya Kamada
gitlab-ce
Commits
94716c27
Commit
94716c27
authored
Apr 06, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unnecessary lease as cron job
parent
44ec4002
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
13 deletions
+0
-13
app/workers/stuck_import_jobs_worker.rb
app/workers/stuck_import_jobs_worker.rb
+0
-13
No files found.
app/workers/stuck_import_jobs_worker.rb
View file @
94716c27
...
@@ -2,12 +2,9 @@ class StuckImportJobsWorker
...
@@ -2,12 +2,9 @@ class StuckImportJobsWorker
include
Sidekiq
::
Worker
include
Sidekiq
::
Worker
include
CronjobQueue
include
CronjobQueue
EXCLUSIVE_LEASE_KEY
=
'fail_stuck_imports_worker_lease'
.
freeze
IMPORT_EXPIRATION
=
15
.
hours
.
to_i
IMPORT_EXPIRATION
=
15
.
hours
.
to_i
def
perform
def
perform
return
unless
try_obtain_lease
stuck_projects
.
find_in_batches
(
batch_size:
500
)
do
|
group
|
stuck_projects
.
find_in_batches
(
batch_size:
500
)
do
|
group
|
jids
=
group
.
map
(
&
:import_jid
)
jids
=
group
.
map
(
&
:import_jid
)
...
@@ -20,8 +17,6 @@ class StuckImportJobsWorker
...
@@ -20,8 +17,6 @@ class StuckImportJobsWorker
fail_batch!
(
completed_jids
,
completed_ids
)
fail_batch!
(
completed_jids
,
completed_ids
)
end
end
end
end
remove_lease
end
end
private
private
...
@@ -39,12 +34,4 @@ class StuckImportJobsWorker
...
@@ -39,12 +34,4 @@ class StuckImportJobsWorker
def
error_message
def
error_message
"Import timed out. Import took longer than
#{
IMPORT_EXPIRATION
}
seconds"
"Import timed out. Import took longer than
#{
IMPORT_EXPIRATION
}
seconds"
end
end
def
try_obtain_lease
@uuid
=
Gitlab
::
ExclusiveLease
.
new
(
EXCLUSIVE_LEASE_KEY
,
timeout:
30
.
minutes
).
try_obtain
end
def
remove_lease
Gitlab
::
ExclusiveLease
.
cancel
(
EXCLUSIVE_LEASE_KEY
,
@uuid
)
end
end
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