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
24a4199a
Commit
24a4199a
authored
Jul 03, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce a delay between stage_id scheduled migrations
parent
5e2baaf3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb
...0170628080858_migrate_stage_id_reference_in_background.rb
+1
-1
spec/migrations/migrate_stage_id_reference_in_background_spec.rb
...grations/migrate_stage_id_reference_in_background_spec.rb
+4
-4
No files found.
db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb
View file @
24a4199a
...
...
@@ -16,7 +16,7 @@ class MigrateStageIdReferenceInBackground < ActiveRecord::Migration
Build
.
where
(
stage_id:
nil
).
in_batches
(
of:
BATCH_SIZE
)
do
|
relation
|
jobs
=
relation
.
pluck
(
:id
).
map
{
|
id
|
[
MIGRATION
,
[
id
]]
}
schedule
=
index
*
5
.
minutes
schedule
=
index
*
2
.
minutes
index
+=
1
BackgroundMigrationWorker
.
perform_bulk_in
(
schedule
,
jobs
)
...
...
spec/migrations/migrate_stage_id_reference_in_background_spec.rb
View file @
24a4199a
...
...
@@ -47,10 +47,10 @@ describe MigrateStageIdReferenceInBackground, :migration, :sidekiq do
Timecop
.
freeze
do
migrate!
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_migration
(
5
.
minutes
,
1
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_migration
(
5
.
minutes
,
2
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_migration
(
10
.
minutes
,
3
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_migration
(
10
.
minutes
,
4
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_migration
(
2
.
minutes
,
1
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_migration
(
2
.
minutes
,
2
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_migration
(
4
.
minutes
,
3
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_migration
(
4
.
minutes
,
4
)
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
5
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