FIX: Use a mutex when reseting column information while seeding.
`rake multisite:migrate` runs SeedFu concurently in threads so we need this to be thread safe.
This commit is contained in:
parent
0384b6d910
commit
d775338d63
|
@ -1,9 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class SeedData::Refresher
|
||||
@mutex = Mutex.new
|
||||
|
||||
def self.refresh!
|
||||
return if @refreshed
|
||||
|
||||
@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.
|
||||
|
@ -13,6 +17,7 @@ class SeedData::Refresher
|
|||
|
||||
@refreshed = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
SeedData::Refresher.refresh!
|
||||
|
|
Loading…
Reference in New Issue