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
Léo-Paul Géneau
gitlab-ce
Commits
c645d40a
Commit
c645d40a
authored
Feb 28, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use find_in_batches for rake task
parent
cd393187
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
lib/tasks/gitlab/traces.rake
lib/tasks/gitlab/traces.rake
+11
-3
No files found.
lib/tasks/gitlab/traces.rake
View file @
c645d40a
...
...
@@ -8,10 +8,18 @@ namespace :gitlab do
logger
=
Logger
.
new
(
STDOUT
)
logger
.
info
(
'Archiving legacy traces'
)
job_ids
=
Ci
::
Build
.
complete
.
without_trace_artifact
.
pluck
(
:id
)
job_ids
=
job_ids
.
map
{
|
build_id
|
[
build_id
]
}
Ci
::
Build
.
joins
(
'RIGHT JOIN ci_job_artifacts ON ci_job_artifacts.job_id = ci_builds.id'
)
.
finished
.
where
(
'ci_job_artifacts.file_type <> 3'
)
.
group
(
'ci_builds.id'
)
.
order
(
id: :asc
)
.
find_in_batches
(
batch_size:
1000
)
do
|
jobs
|
job_ids
=
jobs
.
map
{
|
job
|
[
job
.
id
]
}
ArchiveLegacyTraceWorker
.
bulk_perform_async
(
job_ids
)
logger
.
info
(
"Scheduled
#{
job_ids
.
count
}
jobs. From
#{
job_ids
.
min
}
#{
job_ids
.
max
}
"
)
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