On 02/12/2011, at 6:02 PM, James Healy wrote:

> You definitely don't want to farm HTTP requests into threads.
> 
> Farm CPU bound code onto threads, keep IO bound code on the main event loop.
> 
> Use em-http-request to do HTTP requests on the event loop.
> 

Thanks a lot. It looks like exactly what I need.

The only difference is that I am not writing a server. I am going to use it to 
lazily execute execute HTTP requests while keep the app running.
So for example, in the typical Rails app this code would not care about 
sync/async:

# in the controller
post = Post.find(123) # Executes HTTP request, but doesn't block
do_somethig_else_here

# A bit further, maybe in the view:
post.title # Here it either waits for the request to finish or, if it's already 
finished,  just returns the value

This hides the complexity of the async processing with much simpler interface.
Do you think it is a valid use-case for the em-http-request?

Cheers.

-- 
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