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
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
Show 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
...
@@ -45,12 +45,17 @@ class StuckCiJobsWorker
end
end
def
search
(
status
,
timeout
)
def
search
(
status
,
timeout
)
Ci
::
Build
.
where
(
status:
status
).
in_batches
(
of:
1000
)
do
|
batch
|
loop
do
batch
=
batch
.
where
(
'ci_builds.updated_at < ?'
,
timeout
.
ago
)
jobs
=
Ci
::
Build
.
where
(
status:
status
)
.
where
(
'ci_builds.updated_at < ?'
,
timeout
.
ago
)
.
joins
(
:project
).
merge
(
Project
.
without_deleted
)
.
joins
(
:project
).
merge
(
Project
.
without_deleted
)
.
includes
(
:tags
,
:runner
,
project: :namespace
)
.
includes
(
:tags
,
:runner
,
project: :namespace
)
batch
.
each
do
|
build
|
.
limit
(
100
)
yield
(
build
)
.
to_a
break
if
jobs
.
empty?
jobs
.
each
do
|
job
|
yield
(
job
)
end
end
end
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