From 69ec6899f981880520cd585410c919f48731954f Mon Sep 17 00:00:00 2001 From: Osama Sayegh Date: Thu, 11 Nov 2021 16:16:53 +0300 Subject: [PATCH] Revert "DEV: increase lock timeout for multisite migration (#14831)" (#14883) * Revert "DEV: increase lock timeout for multisite migration (#14831)" This partially reverts commit 337ef60303bbc20619004fc6e5daa284eb59383c. We need to revert the mutex around `db:status:json` because the mutex is not available unless the rails environment is loaded which the `db:status:json` doesn't load before the mutex. We can't load the environment before entering the mutex because the mutex is meant to prevent other instances of the task from loading a rails environment while the database is migrating. Co-authored-by: David Taylor Co-authored-by: David Taylor --- lib/tasks/db.rake | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index fa5e26db162..8d0c37013e8 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -548,14 +548,12 @@ end desc 'Check that the DB can be accessed' task 'db:status:json' do - DistributedMutex.synchronize('db_migration', redis: Discourse.redis.without_namespace, validity: 1200) do - begin - Rake::Task['environment'].invoke - DB.query('SELECT 1') - rescue - puts({ status: 'error' }.to_json) - else - puts({ status: 'ok' }.to_json) - end + begin + Rake::Task['environment'].invoke + DB.query('SELECT 1') + rescue + puts({ status: 'error' }.to_json) + else + puts({ status: 'ok' }.to_json) end end