Re-schedule jobs created by the reminder command if node process goes down
See original GitHub issueProblem
The user can create a reminder for the next day, but if the node process goes down (this happens frequently), the reminder message won’t be sent.
Proposed Solution
store in the DB and load from the DB, because the node instance could be replace with another or load balanced for example. (from this PR)
Tasks
- New collection called
jobs
that have a id, reminderMessage, status with the possible values: “scheduled”, “running”, “finished”, “error”, and an optional name. - At startup time (
index.ts
), read from thejobs
collection to reschedule the jobs that are in anerror
state - Gracefully shutdown and save the jobs on the DB, these jobs could be in memory until the process shutsdown, for example an array of these objects that gets a new entry on the reminder command. We could catch the process shutdown like this:
process.on('SIGTERM', () => {
console.info('SIGTERM signal received.');
//...
});
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9 (5 by maintainers)
Top Results From Across the Web
How To Use node-cron to Run Scheduled Jobs in Node.js
Use Node.js and the node-cron library to schedule jobs to manage logs, back up databases, and send emails.
Read more >Cancel node-schedule event after it has been set
In order to retrieve a specific job, you could create it with a unique name and you can retrieve it later via that...
Read more >SLURM: Scheduling and Managing Jobs | ACCRE
SLURM (Simple Linux Utility for Resource Management) is a software package for submitting, scheduling, and monitoring jobs on large compute clusters.
Read more >How to Schedule a Job in Node Using node-cron
To schedule a job, you need to invoke the nodeCron.schedule method with two arguments. There is a third optional argument that you can...
Read more >worker/README.md at main · graphile/worker - GitHub
If you're running really lean, you can run Graphile Worker in the same Node process as your server to keep costs and devops...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Why stalebot, why!? 😂
@eddiejaoude we probably need to reconfigure the stale bot. He is ignoring your comment to say there is activity 😅