[Catalyst] Taking advantage of idle periods by performing some action(s)

Bill Moseley moseley at hank.org
Thu Mar 25 14:01:23 GMT 2010

On Thu, Mar 25, 2010 at 5:30 AM, Ido Perlmuter <ido at ido50.net> wrote:

> I'm looking for direction on how to possibly implement a feature in a
> Catalyst app that automatically performs some action, or actions, when the
> app is idle and hasn't been accepting requests (either none or some small
> number). For example, let's say I want my app to take advantage of such
> situations by indexing documents to KinoSearch, rebuilding a sitemap.xml
> file, whatever.

Doesn't really seems like the job of a Catalyst app to run background tasks.

What's wrong with cron?  It can run a script and see if the machine's load
is low (or some other measurement) before deciding to run.

> Thing is, I do not want (if possible) to implement a job queue such as
> TheSchwartz. I do not want an outside worker, I want my app to be the
> worker, and let it decide by itself what to do instead of take jobs from a
> queue.

Yes, you do want an outside worker.  It can be part of  your app, but it
should be separate from Catalyst.  Put it in a model class.  Ok, sure you
could have cron run App/script/app_test.pl /path/to/action but why load all
of Catalyst just to run some code in your application?

-- =

Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100325/dfb22=

More information about the Catalyst mailing list