Sinatra stream(:keep_open) not holding connections open
W. Andrew Loe III
andrew at andrewloe.com
Wed Dec 5 06:09:53 UTC 2012
Works great! Thank you very much for the quick response and patch!
Feature Request: https://github.com/celluloid/celluloid-io
Celluloid::IO backend, the spiritual successor to cool.io. I'm going
to take a stab at this soon, but wanted to get something out.
On Tue, Dec 4, 2012 at 7:18 PM, Eric Wong <normalperson at yhbt.net> wrote:
> "W. Andrew Loe III" <andrew at andrewloe.com> wrote:
>> I've pushed a very very stripped down example that just echos the time.
> Thanks for the test case, I've just pushed out the following fix
> to "master" of git://bogomips.org/rainbows.git
> I've pushed a rainbows 18.104.22.168.gd5c8c prerelease to RubyGems.org
> It should be installable with: gem install --pre rainbows
> I expect this to work for you, but be sure to let me know if it doesn't :x
> Since this is a pretty small fix, I think I'll push 4.4.2 final
> very soon.
> >From d5c8cc8b51619f0d33f75036c53e3936ad2749b2 Mon Sep 17 00:00:00 2001
> From: Eric Wong <normalperson at yhbt.net>
> Date: Wed, 5 Dec 2012 03:08:19 +0000
> Subject: [PATCH] event_machine: properly defer body.close for async
> Calling body.close in the normal write_response() code path
> is incorrect, and only worked out of sheer luck with
> Cramp and async_sinata.
> This change allows stream(:keep_open) in Sinatra to work
> Thanks to W. Andrew Loe III for the informative bug report
> and reproducible test case.
> ref: http://mid.gmane.org/CA+-9oNd1EFqsniPkkPTwu5opTCinbM7-2KHoXov7+y3LE4s4Tg@mail.gmail.com
> lib/rainbows/event_machine/client.rb | 3 +++
> 1 file changed, 3 insertions(+)
> diff --git a/lib/rainbows/event_machine/client.rb b/lib/rainbows/event_machine/client.rb
> index e56931f..fc0dfe3 100644
> --- a/lib/rainbows/event_machine/client.rb
> +++ b/lib/rainbows/event_machine/client.rb
> @@ -64,8 +64,11 @@ class Rainbows::EventMachine::Client < EM::Connection
> @state = :headers if alive
> if body.respond_to?(:errback) && body.respond_to?(:callback)
> @deferred = body
> + write_headers(status, headers, alive)
> + write_body_each(body)
> deferred_callback(body, alive)
> + return
> elsif body.respond_to?(:to_path)
> st = File.stat(path = body.to_path)
> Eric Wong
> Rainbows! mailing list - rainbows-talk at rubyforge.org
> Do not quote signatures (like this one) or top post when replying
More information about the rainbows-talk