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
c7776ab7
Commit
c7776ab7
authored
Apr 27, 2020
by
Mario de la Ossa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix final_delay exception in MigrationHelpers
parent
8b279be5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
lib/gitlab/database/migration_helpers.rb
lib/gitlab/database/migration_helpers.rb
+1
-1
spec/lib/gitlab/database/migration_helpers_spec.rb
spec/lib/gitlab/database/migration_helpers_spec.rb
+8
-0
No files found.
lib/gitlab/database/migration_helpers.rb
View file @
c7776ab7
...
@@ -1090,7 +1090,7 @@ into similar problems in the future (e.g. when new tables are created).
...
@@ -1090,7 +1090,7 @@ into similar problems in the future (e.g. when new tables are created).
delay_interval
=
BackgroundMigrationWorker
.
minimum_interval
delay_interval
=
BackgroundMigrationWorker
.
minimum_interval
end
end
final_delay
=
nil
final_delay
=
0
model_class
.
each_batch
(
of:
batch_size
)
do
|
relation
,
index
|
model_class
.
each_batch
(
of:
batch_size
)
do
|
relation
,
index
|
start_id
,
end_id
=
relation
.
pluck
(
Arel
.
sql
(
'MIN(id), MAX(id)'
)).
first
start_id
,
end_id
=
relation
.
pluck
(
Arel
.
sql
(
'MIN(id), MAX(id)'
)).
first
...
...
spec/lib/gitlab/database/migration_helpers_spec.rb
View file @
c7776ab7
...
@@ -1373,6 +1373,14 @@ describe Gitlab::Database::MigrationHelpers do
...
@@ -1373,6 +1373,14 @@ describe Gitlab::Database::MigrationHelpers do
end
end
end
end
it
'returns zero when nothing gets queued'
do
Sidekiq
::
Testing
.
fake!
do
final_delay
=
model
.
queue_background_migration_jobs_by_range_at_intervals
(
User
.
none
,
'FooJob'
,
10
.
minutes
)
expect
(
final_delay
).
to
eq
(
0
)
end
end
context
'with batch_size option'
do
context
'with batch_size option'
do
it
'queues jobs correctly'
do
it
'queues jobs correctly'
do
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
...
...
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