Forum: Ruby on Rails Multithreaded BG task which does AR updates okay?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5c485ab97aa085dd150e1a450a70f313?d=identicon&s=25 Tim Haines (Guest)
on 2009-05-22 03:06
(Received via mailing list)
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.
13c60e2a5806406b537daa542d3495da?d=identicon&s=25 huang zhimin (Guest)
on 2009-05-22 03:43
(Received via mailing list)
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@gmail.com> wrote:

> 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
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-05-22 09:18
(Received via mailing list)
On May 22, 2:06 am, Tim Haines <TMHai...@gmail.com> 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
This topic is locked and can not be replied to.