[RFC/PATCH] event_machine: lazily set async env keys

Eric Wong normalperson at yhbt.net
Thu Jul 15 17:05:30 EDT 2010


James Tucker <jftucker at gmail.com> wrote:
> On 15 Jul 2010, at 07:03, Eric Wong wrote:
> 
> > This has the small likelyhood of breaking apps that
> > check via:
> >  env.include?("async.callback")
> > 
> > Or any of member?/has_key?/key?, as they're all the same method.

> Just regarding the async close, it's used primarily when the client
> disconnects so that you can stop asynchronous operations. It's quite
> important from a resource standpoint.

OK, but the EM::DefaultDeferrable object is never touched (or
even instantiated), then there's no need to close it.

> Why don't you just use a lambda instead of a method?
> 
> lambda { |*args| em_write_response(*args) }
>
> That'd avoid the leak, and provide nearly the same performance
> profile. In fact on 1.9, lambdas are pretty damn quick.

Durr... I didn't think of that :x

Since 1.9.2 is in RC with few users and this bug has a fix (at
http://redmine.ruby-lang.org/issues/show/3466), we might as well leave
the code as-is for now and skip my proposed patch.  Any objections?

I try to avoid working around other projects' bugs (and just helping fix
them).  This is especially the case for things like 1.9.2 which is still
in the very early stages of adoption.

-- 
Eric Wong


More information about the rainbows-talk mailing list