> 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

>
> cr
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" 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/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to