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
d10fbde4
Commit
d10fbde4
authored
May 22, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Targets only problematic live traces
parent
33019bea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
app/workers/rescue_stale_live_trace_worker.rb
app/workers/rescue_stale_live_trace_worker.rb
+10
-7
No files found.
app/workers/rescue_stale_live_trace_worker.rb
View file @
d10fbde4
...
...
@@ -8,15 +8,18 @@ class RescueStaleLiveTraceWorker
# The target jobs are with the following conditions
# - Finished 1 day ago, but it has not had an acthived trace yet
# Jobs finished 1 day ago should have an archived trace. Probably ArchiveTraceWorker failed by Sidekiq's inconsistancy
Ci
::
Build
.
finished
.
where
(
'finished_at BETWEEN ? AND ?'
,
1
.
week
.
ago
,
1
.
day
.
ago
)
.
where
(
'NOT EXISTS (?)'
,
Ci
::
JobArtifact
.
select
(
1
).
trace
.
where
(
'ci_builds.id = ci_job_artifacts.job_id'
))
.
find_in_batch
(
batch_size:
100
)
do
|
jobs
|
job_ids
=
jobs
.
map
{
|
job
|
[
job
.
id
]
}
Ci
::
BuildTraceChunk
.
select
(
:build_id
)
.
group
(
:build_id
)
.
joins
(
:build
)
.
merge
(
Ci
::
Build
.
finished
)
.
where
(
'ci_builds.finished_at < ?'
,
1
.
hour
.
ago
)
.
each
do
|
chunks
|
# TODO: find_each gives an error because of group_by
build_ids
=
chunks
.
map
{
|
chunk
|
[
chunk
.
build_id
]
}
ArchiveTraceWorker
.
bulk_perform_async
(
job
_ids
)
ArchiveTraceWorker
.
bulk_perform_async
(
build
_ids
)
Rails
.
logger
.
warning
"Scheduled to archive stale live traces from
#{
job_ids
.
min
}
to
#{
job
_ids
.
max
}
"
Rails
.
logger
.
warning
"Scheduled to archive stale live traces from
#{
build_ids
.
min
}
to
#{
build
_ids
.
max
}
"
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