summaryrefslogtreecommitdiff
path: root/app/services/merge_requests
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2019-03-28 09:19:14 +0000
committerSean McGivern <sean@gitlab.com>2019-03-28 09:19:14 +0000
commit1ab4d12aae9897e48df054a7c58944c5c73a2759 (patch)
tree730ecd88e33b6514e4c1ff0020ab3a793c073004 /app/services/merge_requests
parentfd3f70c3157da3fbf15c40c48c14c3feaaadcf86 (diff)
parent0e831b0b692f2988d3c84fc01a463b08afec05ad (diff)
downloadgitlab-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.rb23
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