mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 11:31:41 +00:00
fix: correr chdir de a uno por thread
como jekyll no es multi-threaded, pero rails si, es posible que se produzca una excepción en Dir.chdir si se intenta leer sitios concurrentemente (por ejemplo, abrir dos pestañas del mismo sitio). closes #13717 closes #13716 closes #13715 closes #13619
This commit is contained in:
parent
d17db5428a
commit
bb7487e941
1 changed files with 7 additions and 1 deletions
|
@ -447,6 +447,10 @@ class Site < ApplicationRecord
|
||||||
find_by(name: "#{Site.domain}.")
|
find_by(name: "#{Site.domain}.")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.one_at_a_time
|
||||||
|
@@one_at_a_time ||= Thread::Mutex.new
|
||||||
|
end
|
||||||
|
|
||||||
def reset
|
def reset
|
||||||
@read = false
|
@read = false
|
||||||
@layouts = nil
|
@layouts = nil
|
||||||
|
@ -553,7 +557,9 @@ class Site < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_in_path(&block)
|
def run_in_path(&block)
|
||||||
Dir.chdir path, &block
|
Site.one_at_a_time.synchronize do
|
||||||
|
Dir.chdir path, &block
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Instala las gemas cuando es necesario:
|
# Instala las gemas cuando es necesario:
|
||||||
|
|
Loading…
Reference in a new issue