简体   繁体   中英

node-schedule on Heroku (not Scheduler add-on from Heroku)

I would like to have some emails executed on a certain date at a certain time as a one off execution. node-scheduler looks like the one for the job and I was just wondering if there is going to be any problem with using this on the Heroku servers in terms of it restarting once a day and whether or not this will disrupt whatever the node-scheduler uses to do its thang?

Only two issues you may need to consider:

  1. What happens if the server restarts right at the time it's scheduled to execute? This is unlikely but it's still possible. If this is a critical concern I'd probably set a time_of_last_run value on the job in the database. Then upon start, if the last run time is before the last expected time, you probably missed executing it.

  2. When the 'next' server comes back up you'll need to re-schedule the job. That means you'll need to store these jobs in some sort of database.

Other than those, shouldn't have a problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM