Forum: Ruby on Rails Automatically start a long-running process?

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.
Jason N. (Guest)
on 2006-12-29 16:00
(Received via mailing list)
I need to run a query every 10 seconds or so on my DB, and take certain
actions if necessary. The way I've been doing this is to have a class
method that contains an infinite loop. I start this method with an init
script that calls script/runner. I'm wondering if there's a better way
to do this - for instance, could I somehow start that method when my app
starts up and thread it out? What I have works, but it seems that there
should be a more graceful way to do it.
Jason
Al E. (Guest)
on 2006-12-29 17:53
Jason N. wrote:
> ...I'm wondering if there's a better way
> to do this - for instance, could I somehow start that method when my app
> starts up and thread it out?

Look at backgroundrb:

http://backgroundrb.rubyforge.org/

Even though it's "not ready for prime time" according to the author(s),
I've been using the older version on a production site, with no problems
I couldn't hack around, for about three months.

And the latest version is substantially better. It's good stuff.

--Al Evans
This topic is locked and can not be replied to.