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
99b0542c
Commit
99b0542c
authored
Feb 28, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add post migration for checksum calculation
parent
22a7f1f9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
0 deletions
+38
-0
app/workers/all_queues.yml
app/workers/all_queues.yml
+2
-0
app/workers/update_artifact_checksum_worker.rb
app/workers/update_artifact_checksum_worker.rb
+11
-0
db/post_migrate/20180228121020_update_checksum_for_ci_job_artifacts.rb
...te/20180228121020_update_checksum_for_ci_job_artifacts.rb
+25
-0
No files found.
app/workers/all_queues.yml
View file @
99b0542c
...
...
@@ -104,3 +104,5 @@
-
update_user_activity
-
upload_checksum
-
web_hook
-
object_storage:update_artifact_checksum_worker
\ No newline at end of file
app/workers/update_artifact_checksum_worker.rb
0 → 100644
View file @
99b0542c
class
UpdateArtifactChecksumWorker
include
ApplicationWorker
include
ObjectStorageQueue
def
perform
(
job_artifact_id
)
Ci
::
JobArtifact
.
find_by
(
id:
job_artifact_id
).
try
do
|
job_artifact
|
job_artifact
.
set_checksum
job_artifact
.
save!
end
end
end
db/post_migrate/20180228121020_update_checksum_for_ci_job_artifacts.rb
0 → 100644
View file @
99b0542c
class
UpdateChecksumForCiJobArtifacts
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
BATCH_SIZE
=
2500
class
JobArtifact
<
ActiveRecord
::
Base
include
EachBatch
self
.
table_name
=
'ci_job_artifacts'
end
def
up
UpdateChecksumForCiJobArtifacts
::
JobArtifact
.
where
(
'checksum IS NULL'
)
.
each_batch
(
of:
BATCH_SIZE
)
do
|
relation
|
ids
=
relation
.
pluck
(
:id
).
map
{
|
id
|
[
id
]
}
UpdateArtifactChecksumWorker
.
bulk_perform_async
(
ids
)
end
end
def
down
# no-op
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