Heroku best practice clocks with node.js
heroku, node.js, scheduled-tasks
Solution
Heroku says clock processes should trigger a new dyno, which makes sense for scalability since you could turn your frequency up to 11 and break the clock process. https://devcenter.heroku.com/articles/scheduled-jobs-custom-clock-processes
I would use https://github.com/toots/node-heroku to kick off new processes in separate one-time dynos. But, if you want to have a pool of workers that process clock processes, than you'll need a queue like Resque or Kue. The clock process will enqueue new tasks and the worker process(es) will dequeue them.
Problem
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.