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