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:
parent
4aad18d913
commit
337ef60303
|
@ -114,7 +114,7 @@ task 'multisite:migrate' => ['db:load_config', 'environment', 'set_locale'] do |
|
||||||
raise "Multisite migrate is only supported in production"
|
raise "Multisite migrate is only supported in production"
|
||||||
end
|
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
|
# TODO: Switch to processes for concurrent migrations because Rails migration
|
||||||
# is not thread safe by default.
|
# is not thread safe by default.
|
||||||
concurrency = 1
|
concurrency = 1
|
||||||
|
@ -548,12 +548,14 @@ end
|
||||||
|
|
||||||
desc 'Check that the DB can be accessed'
|
desc 'Check that the DB can be accessed'
|
||||||
task 'db:status:json' do
|
task 'db:status:json' do
|
||||||
begin
|
DistributedMutex.synchronize('db_migration', redis: Discourse.redis.without_namespace, validity: 1200) do
|
||||||
Rake::Task['environment'].invoke
|
begin
|
||||||
DB.query('SELECT 1')
|
Rake::Task['environment'].invoke
|
||||||
rescue
|
DB.query('SELECT 1')
|
||||||
puts({ status: 'error' }.to_json)
|
rescue
|
||||||
else
|
puts({ status: 'error' }.to_json)
|
||||||
puts({ status: 'ok' }.to_json)
|
else
|
||||||
|
puts({ status: 'ok' }.to_json)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue