5

I'm wondering what the best way is to setup a clock process on Heroku. My app is built entirely in Node and I was planning on using node-schedule to specify my schedules.

My question is: should the clock process itself trigger the events in my cron process and run them within it's own allocated dyno? Heroku seems to indicate that you should use a worker to handle this. In that case, I'm wondering how I can get my clock process to tell the worker to run a specific procedure?

I've been reading up on the Python method to do this and it seems like they are simply triggering the process within the same dyno.

Thanks.

4

1 回答 1

2

Heroku 说时钟进程应该触发一个新的测功机,这对于可扩展性是有意义的,因为你可以将频率提高到 11 并中断时钟进程。https://devcenter.heroku.com/articles/scheduled-jobs-custom-clock-processes

我会使用https://github.com/toots/node-heroku在单独的一次性 dynos 中启动新进程。但是,如果您想拥有一个处理时钟进程的工作人员池,那么您将需要一个像 Resque 或 Kue 这样的队列。时钟进程将新任务加入队列,工作进程将它们出列。

于 2013-07-28T19:46:12.113 回答