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
Boxiang Sun
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
app/workers/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