grape
https://github.com/intridea/grape
Ruby
An opinionated framework for creating REST-like APIs in Ruby.
Gitlab::Database::MigrationHelpers#bulk_queue_background_migration_jobs_by_range
Bulk queues background migration jobs for an entire table, batched by ID range.
"Bulk" meaning many jobs will be pushed at a time for efficiency.
If you need a delay interval per job, then use `queue_background_migration_jobs_by_range_at_intervals`.
model_class - The table being iterated over
job_class_name - The background migration job class as a string
batch_size - The maximum number of rows per job
Example:
class Route < ActiveRecord::Base
include EachBatch
self.table_name = 'routes'
end
bulk_queue_background_migration_jobs_by_range(Route, 'ProcessRoutes')
Where the model_class includes EachBatch, and the background migration exists:
class Gitlab::BackgroundMigration::ProcessRoutes
def perform(start_id, end_id)
# do something
end
endEdit
git clone [email protected]:intridea/grape.git
cd grape
open
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Gitlab--Database--MigrationHelpers-bulk_queue_background_migration_jobs_by_range-for-pr
# Commit to gitgit add git commit -m "better docs for Gitlab::Database::MigrationHelpers#bulk_queue_background_migration_jobs_by_range"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Gitlab--Database--MigrationHelpers-bulk_queue_background_migration_jobs_by_range-for-pr
hub pull-request
# Celebrate!