diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-06-29 11:41:19 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-07 15:08:15 +0200 |
commit | 945cdf326edcafdcd7a1d2aeaef611d888a4828e (patch) | |
tree | 36c5f5e2dd14fa2afd3f8708886a1354254b1315 /doc/development | |
parent | 07693b43745e31e47466a9f1f5b73de894323a5d (diff) | |
download | gitlab-ce-945cdf326edcafdcd7a1d2aeaef611d888a4828e.tar.gz |
Make it possible to schedule bg migrations in bulk
Diffstat (limited to 'doc/development')
-rw-r--r-- | doc/development/background_migrations.md | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/doc/development/background_migrations.md b/doc/development/background_migrations.md index 0239e6b3163..a58f161fc30 100644 --- a/doc/development/background_migrations.md +++ b/doc/development/background_migrations.md @@ -50,14 +50,14 @@ your migration: BackgroundMigrationWorker.perform_async('BackgroundMigrationClassName', [arg1, arg2, ...]) ``` -Usually it's better to schedule jobs in bulk, for this you can use +Usually it's better to enqueue jobs in bulk, for this you can use `BackgroundMigrationWorker.perform_bulk`: ```ruby BackgroundMigrationWorker.perform_bulk( - ['BackgroundMigrationClassName', [1]], - ['BackgroundMigrationClassName', [2]], - ... + [['BackgroundMigrationClassName', [1]], + ['BackgroundMigrationClassName', [2]], + ...] ) ``` @@ -68,6 +68,17 @@ consuming migrations it's best to schedule a background job using an updates. Removals in turn can be handled by simply defining foreign keys with cascading deletes. +If you would like to schedule jobs in bulk with a delay, you can use +`BackgroundMigrationWorker.perform_bulk_in`: + +```ruby +jobs = [['BackgroundMigrationClassName', [1]], + ['BackgroundMigrationClassName', [2]], + ...] + +BackgroundMigrationWorker.perform_bulk_in(5.minutes, jobs) +``` + ## Cleaning Up Because background migrations can take a long time you can't immediately clean |