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

27 lines
673 B
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
module MergeRequests
class MigrateExternalDiffsService < ::BaseService
2021-04-29 21:17:54 +05:30
MAX_JOBS = 1000
2019-07-07 11:18:12 +05:30
attr_reader :diff
def self.enqueue!
ids = MergeRequestDiff.ids_for_external_storage_migration(limit: MAX_JOBS)
2020-03-13 15:44:24 +05:30
# rubocop:disable Scalability/BulkPerformWithContext
# https://gitlab.com/gitlab-org/gitlab/issues/202100
2019-07-07 11:18:12 +05:30
MigrateExternalDiffsWorker.bulk_perform_async(ids.map { |id| [id] })
2020-03-13 15:44:24 +05:30
# rubocop:enable Scalability/BulkPerformWithContext
2019-07-07 11:18:12 +05:30
end
def initialize(merge_request_diff)
@diff = merge_request_diff
end
def execute
diff.migrate_files_to_external_storage!
end
end
end