1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
module ActionController class Lock def initialize(app) @app = app @lock = Mutex.new end def call(env) old_multithread = env["rack.multithread"] env["rack.multithread"] = false response = @lock.synchronize do @app.call(env) end env["rack.multithread"] = old_multithread response end end end