diff options
author | Sean McGivern <sean@gitlab.com> | 2019-03-28 09:19:14 +0000 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-03-28 09:19:14 +0000 |
commit | 1ab4d12aae9897e48df054a7c58944c5c73a2759 (patch) | |
tree | 730ecd88e33b6514e4c1ff0020ab3a793c073004 /app/services/merge_requests | |
parent | fd3f70c3157da3fbf15c40c48c14c3feaaadcf86 (diff) | |
parent | 0e831b0b692f2988d3c84fc01a463b08afec05ad (diff) | |
download | gitlab-ce-1ab4d12aae9897e48df054a7c58944c5c73a2759.tar.gz |
Merge branch '54670-external-diffs-when-outdated' into 'master'
Allow external diffs to be used conditionally
Closes #54670
See merge request gitlab-org/gitlab-ce!25432
Diffstat (limited to 'app/services/merge_requests')
-rw-r--r-- | app/services/merge_requests/migrate_external_diffs_service.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/services/merge_requests/migrate_external_diffs_service.rb b/app/services/merge_requests/migrate_external_diffs_service.rb new file mode 100644 index 00000000000..16050244637 --- /dev/null +++ b/app/services/merge_requests/migrate_external_diffs_service.rb @@ -0,0 +1,23 @@ +# 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 |