diff --git a/lib/rack-emstream.rb b/lib/rack-emstream.rb index a288b40..c68f7be 100644 --- a/lib/rack-emstream.rb +++ b/lib/rack-emstream.rb @@ -19,11 +19,11 @@ module Rack def _call(env) result = @app.call(env) + result[2].close if result[2].respond_to?(:close) + EM.next_tick { env['async.callback'].call [ result[0], result[1], self ] - result[2].close if result[2].respond_to?(:close) - result[2].each { |data| EM.next_tick { @callback.call(data) } } EM.next_tick { succeed } } diff --git a/lib/rack-emstream/version.rb b/lib/rack-emstream/version.rb index 3e6a9d2..7095510 100644 --- a/lib/rack-emstream/version.rb +++ b/lib/rack-emstream/version.rb @@ -1,5 +1,5 @@ module Rack class EMStream - VERSION = "0.1.1" + VERSION = "0.1.2" end end