ensure responses get passed through even if not running under thin

This commit is contained in:
John Bintz 2012-09-19 10:48:06 -04:00
parent 4a658a84d8
commit fd5a05afae
3 changed files with 25 additions and 19 deletions

View File

@ -18,7 +18,7 @@ class FileStreamer
end end
end end
# then respond with a FileStreamer # then respond with a `FileStreamer`
def call(env) def call(env)
# ... do stuff ... # ... do stuff ...
@ -44,3 +44,5 @@ use Rack::EMStream do |exception, environment|
end end
``` ```
I'm still pretty n00b to async stuff, so if you have suggestions, let me know!

View File

@ -21,6 +21,7 @@ module Rack
result[2].close if result[2].respond_to?(:close) result[2].close if result[2].respond_to?(:close)
if env['async.callback']
EM.next_tick { EM.next_tick {
env['async.callback'].call [ result[0], result[1], self ] env['async.callback'].call [ result[0], result[1], self ]
@ -42,6 +43,9 @@ module Rack
} }
throw :async throw :async
else
result
end
end end
end end
end end

View File

@ -1,5 +1,5 @@
module Rack module Rack
class EMStream class EMStream
VERSION = "0.1.3" VERSION = "0.1.4"
end end
end end