mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 11:51:42 +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}.")
|
||||
end
|
||||
|
||||
def self.one_at_a_time
|
||||
@@one_at_a_time ||= Thread::Mutex.new
|
||||
end
|
||||
|
||||
def reset
|
||||
@read = false
|
||||
@layouts = nil
|
||||
|
@ -553,8 +557,10 @@ class Site < ApplicationRecord
|
|||
end
|
||||
|
||||
def run_in_path(&block)
|
||||
Site.one_at_a_time.synchronize do
|
||||
Dir.chdir path, &block
|
||||
end
|
||||
end
|
||||
|
||||
# Instala las gemas cuando es necesario:
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue