Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2019-02-20 18:35:57 +0300
committerNick Thomas <nick@gitlab.com>2019-03-27 19:51:33 +0300
commit0e831b0b692f2988d3c84fc01a463b08afec05ad (patch)
tree3fdcb423db62141b2db2d2cc3f39986fb929c8af /app/workers/migrate_external_diffs_worker.rb
parent98824f3e97e24a5d6cb0688167bc8411a74739fc (diff)
Allow external diffs to be used conditionally
Since external diffs are likely to be a bit slower than in-database ones, add a mode that makes diffs external after they've been obsoleted by events. This should strike a balance between performance and disk space. A background cron drives the majority of migrations, since diffs become outdated through user actions.
Diffstat (limited to 'app/workers/migrate_external_diffs_worker.rb')
-rw-r--r--app/workers/migrate_external_diffs_worker.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/workers/migrate_external_diffs_worker.rb b/app/workers/migrate_external_diffs_worker.rb
new file mode 100644
index 00000000000..debac97af2c
--- /dev/null
+++ b/app/workers/migrate_external_diffs_worker.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: false
+
+class MigrateExternalDiffsWorker
+ include ApplicationWorker
+
+ def perform(merge_request_diff_id)
+ diff = MergeRequestDiff.find_by_id(merge_request_diff_id)
+ return unless diff
+
+ MergeRequests::MigrateExternalDiffsService.new(diff).execute
+ end
+end