blob: 07f498319c106831b6e9d3aacd52779bf9e4ba99 (
plain) (
tree)
|
|
require 'active_support/dependencies'
require 'rack/body_proxy'
module ActionDispatch
class LoadInterlock
def initialize(app)
@app = app
end
def call(env)
interlock = ActiveSupport::Dependencies.interlock
interlock.start_running
response = @app.call(env)
body = Rack::BodyProxy.new(response[2]) { interlock.done_running }
response[2] = body
response
ensure
interlock.done_running unless body
end
end
end
|