FIX: Thread safety issues with multisite:migrate and SeedFu.

This commit is contained in:
Guo Xiang Tan
2020-06-17 16:15:43 +08:00
parent 86b43c5329
commit 45eb97c202
2 changed files with 59 additions and 33 deletions

View File

@@ -1,8 +1,19 @@
# frozen_string_literal: true
# fix any bust caches post initial migration
ActiveRecord::Base.connection.tables.each do |table|
table.classify.constantize.reset_column_information rescue nil
class SeedData::Refresher
def self.refresh!
return if @refreshed
# Fix any bust caches post initial migration
# Not that reset_column_information is not thread safe so we have to becareful
# not to run it concurrently within the same process.
ActiveRecord::Base.connection.tables.each do |table|
table.classify.constantize.reset_column_information rescue nil
end
@refreshed = true
end
end
SeedData::Refresher.refresh!
SiteSetting.refresh!