Hey guys, I''m thinking about writing a method which utilises multithreading to do a bunch of api calls and make AR updates. Then calling the method once an hour with Rufus scheduler. I''m a little concerned if this is safe or not, and I''m wondering if anyone has any insight? I guess the main topic is does multithreading work nicely with AR - but I''m also wondering if using rufus turns it in to a more complicated question? Has anyone seen good articles discussing it? Cheers, Tim.
What we do is to write a rake task that make AR update, and add this running task into cron job, it''s easy and safe. On Fri, May 22, 2009 at 9:06 AM, Tim Haines <TMHaines-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hey guys, > > I''m thinking about writing a method which utilises multithreading to > do a bunch of api > calls and make AR updates. Then calling the method once an hour with > Rufus scheduler. > > I''m a little concerned if this is safe or not, and I''m wondering if > anyone has any insight? I guess the main topic is does multithreading > work nicely with AR - but I''m also wondering if using rufus turns it > in to a more complicated question? > > Has anyone seen good articles discussing it? > > Cheers, > > Tim. > > >-- My home: http://www.huangzhimin.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2009-May-22 07:18 UTC
Re: Multithreaded BG task which does AR updates okay?
On May 22, 2:06 am, Tim Haines <TMHai...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hey guys, > > I''m thinking about writing a method which utilises multithreading to > do a bunch of api > calls and make AR updates. Then calling the method once an hour with > Rufus scheduler.On earlier version of rails you need to explicitly safe that you want AR to be threadsafe (the setting is called allow_concurrency). This isn''t needed from rails 2.2 is my memory is correct. Fred> > I''m a little concerned if this is safe or not, and I''m wondering if > anyone has any insight? I guess the main topic is does multithreading > work nicely with AR - but I''m also wondering if using rufus turns it > in to a more complicated question? > > Has anyone seen good articles discussing it? > > Cheers, > > Tim.