"Fossies" - the Fresh Open Source Software Archive

Member "discourse-2.8.3/db/fixtures/001_refresh.rb" (14 Apr 2022, 609 Bytes) of package /linux/www/discourse-2.8.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ruby source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "001_refresh.rb": 2.7.13_vs_2.8.0.

    1 # frozen_string_literal: true
    2 
    3 class SeedData::Refresher
    4   @mutex = Mutex.new
    5 
    6   def self.refresh!
    7     return if @refreshed
    8 
    9     @mutex.synchronize do
   10       return if @refreshed
   11       # Fix any bust caches post initial migration
   12       # Not that reset_column_information is not thread safe so we have to be careful
   13       # not to run it concurrently within the same process.
   14       ActiveRecord::Base.connection.tables.each do |table|
   15         table.classify.constantize.reset_column_information rescue nil
   16       end
   17 
   18       @refreshed = true
   19     end
   20   end
   21 end
   22 
   23 SeedData::Refresher.refresh!
   24 SiteSetting.refresh!