From 850d5696f2b26c1a090bbbab4224d64f4f1396ed Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 5 Aug 2020 15:10:37 +0800 Subject: [PATCH] FIX: Disable concurrent migration for `multisite:migrate`. Rails migration is not thread safe. --- lib/tasks/db.rake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index b0bdd0a9651..c3284acc70e 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -114,7 +114,9 @@ task 'multisite:migrate' => ['db:load_config', 'environment', 'set_locale'] do | raise "Multisite migrate is only supported in production" end - concurrency = (ENV['MIGRATE_CONCURRENCY'].presence || "20").to_i + # TODO: Switch to processes for concurrent migrations because Rails migration + # is not thread safe by default. + concurrency = 1 puts "Multisite migrator is running using #{concurrency} threads" puts