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

Peter Karman peter at peknet.com
Thu Mar 25 15:32:28 GMT 2010


Ido Perlmuter wrote on 03/25/2010 10:04 AM:
> Kiffin, thanks for the heads up about Plugin::Scheduler, seems to fit my
> needs quite good.
>

> Starting an external worker that needs to connect to the schema and
> try hard to figure out what's going on in the already running Catalyst
> process is pointless, hard to implement and kinda ugly (in my opinion).

I won't argue with the ugly part, since taste is personal, but if it is
hard to connect to the schema and start background processes, I suspect
your application architecture needs a re-think. Catalyst is for gluing
HTTP onto an application. If you're doing more than that, the
architecture needs reconsideration.

> My app is already up and
> running, why start a new process? it's those idle moments when nobody
> seems to visit my stupid websites that I want the app to employ itself
> with some useful tasks.

Scheduler is triggered on requests. So by definition your app is not idle.

Bill's point is that if you have non-HTTP request cycle actions as part
of your business model, they don't belong in your Catalyst app. That
doesn't mean you can't reuse parts of the code in your Catalyst app, but
that the Catalyst engine itself doesn't need to be involved.

cron is your friend.

-- 
Peter Karman  .  http://peknet.com/  .  peter at peknet.com



More information about the Catalyst mailing list