debian-mirror-gitlab/app/services/merge_requests/migrate_external_diffs_service.rb

24 lines
504 B
Ruby
Raw Normal View History

2019-05-18 00:54:41 +05:30
# frozen_string_literal: true
module MergeRequests
class MigrateExternalDiffsService < ::BaseService
MAX_JOBS = 1000.freeze
attr_reader :diff
def self.enqueue!
ids = MergeRequestDiff.ids_for_external_storage_migration(limit: MAX_JOBS)
MigrateExternalDiffsWorker.bulk_perform_async(ids.map { |id| [id] })
end
def initialize(merge_request_diff)
@diff = merge_request_diff
end
def execute
diff.migrate_files_to_external_storage!
end
end
end