mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
21 lines
439 B
Ruby
21 lines
439 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "rack/body_proxy"
|
|
|
|
module ActionDispatch
|
|
class Executor
|
|
def initialize(app, executor)
|
|
@app, @executor = app, executor
|
|
end
|
|
|
|
def call(env)
|
|
state = @executor.run!
|
|
begin
|
|
response = @app.call(env)
|
|
returned = response << ::Rack::BodyProxy.new(response.pop) { state.complete! }
|
|
ensure
|
|
state.complete! unless returned
|
|
end
|
|
end
|
|
end
|
|
end
|