2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-06-17 16:15:43 +08:00
|
|
|
class SeedData::Refresher
|
2020-06-23 09:15:29 +08:00
|
|
|
@mutex = Mutex.new
|
|
|
|
|
2020-06-17 16:15:43 +08:00
|
|
|
def self.refresh!
|
|
|
|
return if @refreshed
|
|
|
|
|
2020-06-23 09:15:29 +08:00
|
|
|
@mutex.synchronize do
|
|
|
|
return if @refreshed
|
|
|
|
# Fix any bust caches post initial migration
|
2021-05-21 09:43:47 +08:00
|
|
|
# Not that reset_column_information is not thread safe so we have to be careful
|
2020-06-23 09:15:29 +08:00
|
|
|
# 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
|
2020-06-17 16:15:43 +08:00
|
|
|
|
2020-06-23 09:15:29 +08:00
|
|
|
@refreshed = true
|
|
|
|
end
|
2020-06-17 16:15:43 +08:00
|
|
|
end
|
2020-06-17 13:23:45 +08:00
|
|
|
end
|
|
|
|
|
2020-06-17 16:15:43 +08:00
|
|
|
SeedData::Refresher.refresh!
|
2019-03-19 04:09:13 +08:00
|
|
|
SiteSetting.refresh!
|