2019-02-20 10:35:57 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module MergeRequests
|
|
|
|
class MigrateExternalDiffsService < ::BaseService
|
2021-03-25 23:09:21 -04:00
|
|
|
MAX_JOBS = 1000
|
2019-02-20 10:35:57 -05:00
|
|
|
|
|
|
|
attr_reader :diff
|
|
|
|
|
|
|
|
def self.enqueue!
|
|
|
|
ids = MergeRequestDiff.ids_for_external_storage_migration(limit: MAX_JOBS)
|
|
|
|
|
2020-02-05 13:09:06 -05:00
|
|
|
# rubocop:disable Scalability/BulkPerformWithContext
|
|
|
|
# https://gitlab.com/gitlab-org/gitlab/issues/202100
|
|
|
|
MigrateExternalDiffsWorker.bulk_perform_async(ids.map { |id| [id] })
|
|
|
|
# rubocop:enable Scalability/BulkPerformWithContext
|
2019-02-20 10:35:57 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(merge_request_diff)
|
|
|
|
@diff = merge_request_diff
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
|
|
|
diff.migrate_files_to_external_storage!
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|