Skip to content

Fix incorrect background job scheduling

Alex Pooley requested to merge fix-incorrect-final-delay into master

What does this MR do and why?

Gitlab::Database::Migrations::BackgroundMigrationHelpers#queue_background_migration_jobs_by_range_at_intervals schedules jobs too far in to the future. This is because EachBatch yields an index starting at 1 rather than 0.

In short, if you schedule a job with a delay_interval of X.minutes, then the first job will be scheduled to begin in X.minutes rather than immediately at 0.minutes. The spec changes in this MR demonstrate this well.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Alex Pooley

Merge request reports