question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Re-schedule jobs created by the reminder command if node process goes down

See original GitHub issue

Problem

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 the jobs collection to reschedule the jobs that are in an error 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
eddiejaoudecommented, Sep 30, 2020

Why stalebot, why!? 😂

1reaction
BOLT04commented, Sep 29, 2020

@eddiejaoude we probably need to reconfigure the stale bot. He is ignoring your comment to say there is activity 😅

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found