FIX: Don't attempt to migrate concurrently with other migrations (#14231)
This commit is contained in:
parent
142120753f
commit
d7873dd823
|
@ -114,6 +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
|
||||
# TODO: Switch to processes for concurrent migrations because Rails migration
|
||||
# is not thread safe by default.
|
||||
concurrency = 1
|
||||
|
@ -201,10 +202,12 @@ task 'multisite:migrate' => ['db:load_config', 'environment', 'set_locale'] do |
|
|||
check_exceptions(exceptions)
|
||||
|
||||
Rake::Task['db:_dump'].invoke
|
||||
end
|
||||
end
|
||||
|
||||
# we need to run seed_fu every time we run rake db:migrate
|
||||
task 'db:migrate' => ['load_config', 'environment', 'set_locale'] do |_, args|
|
||||
DistributedMutex.synchronize('db_migration', redis: Discourse.redis.without_namespace, validity: 300) do
|
||||
migrations = ActiveRecord::Base.connection.migration_context.migrations
|
||||
now_timestamp = Time.now.utc.strftime('%Y%m%d%H%M%S').to_i
|
||||
epoch_timestamp = Time.at(0).utc.strftime('%Y%m%d%H%M%S').to_i
|
||||
|
@ -232,6 +235,7 @@ task 'db:migrate' => ['load_config', 'environment', 'set_locale'] do |_, args|
|
|||
if !Discourse.is_parallel_test? && MultisiteTestHelpers.load_multisite?
|
||||
system("RAILS_DB=discourse_test_multisite rake db:migrate")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
task 'test:prepare' => 'environment' do
|
||||
|
|
Loading…
Reference in New Issue