KellysOnTop23 KellysOnTop23 - 10 months ago 58
Node.js Question

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.

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
uses to do its thang?

Answer Source

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.