2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-06-17 04:15:43 -04:00
|
|
|
class SeedData::Refresher
|
2020-06-22 21:15:29 -04:00
|
|
|
@mutex = Mutex.new
|
|
|
|
|
2020-06-17 04:15:43 -04:00
|
|
|
def self.refresh!
|
|
|
|
return if @refreshed
|
|
|
|
|
2020-06-22 21:15:29 -04:00
|
|
|
@mutex.synchronize do
|
|
|
|
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
|
2020-06-17 04:15:43 -04:00
|
|
|
|
2020-06-22 21:15:29 -04:00
|
|
|
@refreshed = true
|
|
|
|
end
|
2020-06-17 04:15:43 -04:00
|
|
|
end
|
2020-06-17 01:23:45 -04:00
|
|
|
end
|
|
|
|
|
2020-06-17 04:15:43 -04:00
|
|
|
SeedData::Refresher.refresh!
|
2019-03-18 16:09:13 -04:00
|
|
|
SiteSetting.refresh!
|