Revert "DEV: increase lock timeout for multisite migration (#14831)" (#14883)

* Revert "DEV: increase lock timeout for multisite migration (#14831)"

This partially reverts commit 337ef60303.

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 <david@taylorhq.com>

Co-authored-by: David Taylor <david@taylorhq.com>
This commit is contained in:
Osama Sayegh 2021-11-11 16:16:53 +03:00 committed by GitHub
parent 095255c8ec
commit 69ec6899f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 9 deletions

View File

@ -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