Thursday 23 January 2020

Node-schedule vs. Cron?

Im trying to build a node server that will need to schedule a bunch of tasks and I’m trying to figure out the difference between node-schedule and node-cron. It looks like their functionality is pretty similar it’s just that node schedule says:“Note that Node Schedule is designed for in-process scheduling, i.e. scheduled jobs will only fire as long as your script is running, and the schedule will disappear when execution completes. If you need to schedule jobs that will persist even when your script isn't running, consider using actual cron.”What does that mean exactly?If it helps here are my exact requirements.1) Receive a task and time (every 30 minutes or at 4pm daily) via Ajax to my Node server on Heroku.2) Store the task data, then create the cron-like scheduled event to run at the given times.3) At the given time, execute a certain event (an outgoing HTTP request).4) If the server goes down for any reason, on start grab all saved tasks from the database and reinitialize them.Note: I want this to be able to scale to a lot of scheduled tasks if needed.Does either package make more sense for my usage if I’m saving the task data anyway, what is in-process scheduling in this regard?

Submitted January 23, 2020 at 03:21PM by ReactiveNative

No comments:

Post a Comment