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

- Increase lock timeout - given multisites may take a while to migrate
- Ensure we do not check for status while db is migrating
This commit is contained in:
Sam 2021-11-09 12:06:06 +11:00 committed by GitHub
parent 4aad18d913
commit 337ef60303
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 8 deletions

View File

@ -114,7 +114,7 @@ task 'multisite:migrate' => ['db:load_config', 'environment', 'set_locale'] do |
raise "Multisite migrate is only supported in production"
end
DistributedMutex.synchronize('db_migration', redis: Discourse.redis.without_namespace, validity: 300) do
DistributedMutex.synchronize('db_migration', redis: Discourse.redis.without_namespace, validity: 1200) do
# TODO: Switch to processes for concurrent migrations because Rails migration
# is not thread safe by default.
concurrency = 1
@ -548,6 +548,7 @@ 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')
@ -557,3 +558,4 @@ task 'db:status:json' do
puts({ status: 'ok' }.to_json)
end
end
end