BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
d58bab4a
Commit
d58bab4a
authored
Nov 21, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use not-ordered search
parent
a26e25ea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
stuck_ci_jobs_worker.rb
app/workers/stuck_ci_jobs_worker.rb
+9
-4
No files found.
app/workers/stuck_ci_jobs_worker.rb
View file @
d58bab4a
...
...
@@ -45,12 +45,17 @@ class StuckCiJobsWorker
end
def
search
(
status
,
timeout
)
Ci
::
Build
.
where
(
status:
status
).
in_batches
(
of:
1000
)
do
|
batch
|
batch
=
batch
.
where
(
'ci_builds.updated_at < ?'
,
timeout
.
ago
)
loop
do
jobs
=
Ci
::
Build
.
where
(
status:
status
)
.
where
(
'ci_builds.updated_at < ?'
,
timeout
.
ago
)
.
joins
(
:project
).
merge
(
Project
.
without_deleted
)
.
includes
(
:tags
,
:runner
,
project: :namespace
)
batch
.
each
do
|
build
|
yield
(
build
)
.
limit
(
100
)
.
to_a
break
if
jobs
.
empty?
jobs
.
each
do
|
job
|
yield
(
job
)
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