If you want to wait till all queries are complete you can use the multi http 
request: 
http://rubydoc.info/github/igrigorik/em-http-request/master/EventMachine/MultiRequest

Dave Newman 
@whatupdave


On Monday, 5 December 2011 at 2:05 PM, Dmytrii Nagirniak wrote:

> I'll see how far I'll go with this. Have enough information to get started on 
> this.
> 
> Thanks to all of you guys!
> 
> Cheers. 
> On 05/12/2011, at 1:44 PM, Simon Russell wrote:
> > > No, no. I do want to hide all callbacks and make the code look like the 
> > > sequential set of commands.
> > > I also want to be able to swap it out for a single-threaded 
> > > implementation as a backup if something goes wrong.
> > 
> > Ah, right, well, em-synchrony could well help there.  It should also
> > make the multi-wait easier to write.
> > 
> > > But wouldn't it raise "non-local return error" when used with Rails as 
> > > Richard explained previously?
> > 
> > Only if you try and do that; there's nothing wrong with running the
> > event loop inside another thread.  You just need to be aware of how
> > that's going to work -- as I said, waiting for the requests to finish,
> > then doing a response then (inside the original thread, not the
> > eventmachine one).  It's basically best if the code you're running
> > inside EventMachine doesn't know anything about the rest of your app;
> > that should keep things reasonably sane.
> > 
> > Simon.
> > 
> > -- 
> > You received this message because you are subscribed to the Google Groups 
> > "Ruby or Rails Oceania" group.
> > To post to this group, send email to [email protected] 
> > (mailto:[email protected]).
> > To unsubscribe from this group, send email to 
> > [email protected] 
> > (mailto:[email protected]).
> > For more options, visit this group at 
> > http://groups.google.com/group/rails-oceania?hl=en.
> > 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby or Rails Oceania" group.
> To post to this group, send email to [email protected] 
> (mailto:[email protected]).
> To unsubscribe from this group, send email to 
> [email protected] 
> (mailto:[email protected]).
> For more options, visit this group at 
> http://groups.google.com/group/rails-oceania?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.

Reply via email to