Background processing in nodejs, mongodb and heroku nodes

I am writing a simple image upload site as a tutorial project.

It is written in knots, with mangodb, and unwrapped on Geroku cedar.

I would like to implement a node script that runs, once an hour, and applies the reddit algorithm to the images and stores the score against each image in mongodb.

How can I achieve this, bearing in mind that I am a hero and have file system limitations? - Considering the architecture of the cedar, it is best to transfer to a separate worker, but if there is a faster / easier / easier approach, I would be glad to hear it. The dev center hero's article on worker / background jobs , unfortunately, does not yet contain any tutorials for such a system.

My previous experience with background processing per hero was with rails - so scheduled add-ons, + delayed_job and it's very straight forward.

+3


source to share


1 answer


An extremely simple approach could be using setInterval or node-cron . You may also want to spawn or fork a child process for this periodic processing.



+3


source







All Articles