Add BaseOperationWorker base class
Ref: #575416 (closed)
What does this MR do and why?
This MR adds a base class to define operations which can be enqueued to our new BBO framework.
You will be able to define an operation as follow and queue it anywhere from the application:
module Gitlab
module BackgroundMigration
class DeleteExpiredTokens < BaseOperationWorker
operation_name :delete_expired_tokens
feature_category :system_access
cursor :id
def perform
each_sub_batch do |sub_batch|
sub_batch.where(revoked_at: ...cutoff_date).delete_all
end
end
end
end
end
Note
It copy over the only the methods leveraging a cursor strategy from Gitlab::BackgroundMigration::BatchedMigrationJob.
This class does not implement distinct_each_batch for simplicity purpose, this can be added later on.
Edited by Max Orefice