From 075f3a2f3c39a4378d435fbe0e5cf9acf9b37982 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Wed, 29 Aug 2012 13:58:18 -0400 Subject: [PATCH] actually put the close within the same tick as the app --- lib/rack-emstream.rb | 4 ++-- lib/rack-emstream/version.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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