On Nov 18, 2008, at 4:49 PM, Aman Gupta wrote:

>
>> In Eventmachine you would use EM::Deferrable for all of your Sequel
>> calls. EM would handle spawning any ruby threads (green threads in
>> MRI, native threads in JRuby). Then use #set_deferred_status in the
>> Deferrable to notify your business logic when the Sequel calls have
>> completed.
>
> You're confusing EM.defer with EM::Deferrable. EM::Deferrable has
> nothing to do with threads, it simply stores a list of callbacks to
> invoke when a certain state is reached. EM.defer uses a ruby
> threadpool of 20 threads and provides a second callback to receive
> notifications when code running in the thread has executed.
>
> The approach I use in my projects it to combine Sequel's SQL
> generation with the em-mysql async api:
>
> EventedMysql.select( User.where(:age > 10).limit(10).sql ) do |rows|
>  rows.each do |data|
>    user = User.load(data)
>    p user.age
>  end
> end

Aman,

thanks for the correction. I've been away from EM for a while so I'm a  
bit rusty with the API.

cr


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to sequel-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to