开发者

How to set up a periodic nodeJS worker on Heroku Cedar

I've got an Express Web app running as my main app on Heroku Cedar. I need to run a worker job periodically. I know I can specify a worker: in my Procfile, but that seems to be for a forever running kind of job. Perhaps there is a way to have the event mechanism of nodeJS caus e the worker to Idle, and use Cron to poke it开发者_高级运维 alive periodically??


to keep your process alive you can try using an external service which will "ping" your application, you can use the newrelice free addon on heroku for that.

I am currently experimenting and it seems that even with this the application is still put in idle mode but it restarts on the next "ping" so it is still up most of the time.

I don't known node.js but I do my worker with Ruby+EventMachine inside a ruby on rails application and it works fine, you just need something to work in the background aside of your web requests.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜