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.

cancelNext not working

See original GitHub issue

Attempting to use the cancelNext feature on a reoccurring job, however, it doesn’t appear to be cancelling the next invocation. Whether I call j.cancelNext() or j.cancelNext(true) nothing happens. By calling j.cancelNext(false) the entire job stops indefinitely.

var rule = new schedule.RecurrenceRule();
rule.second = [new schedule.Range(0, 59)];

var j = schedule.scheduleJob(rule, function(){
  console.log(`Job j ran at: ${new Date()}`);

});

setTimeout(function(){
  console.log('Next invocation without cancellation should be at', j.nextInvocation());
  j.cancelNext(true);
 }, 3000);

Output:

Job j ran at: Sat Feb 24 2018 14:25:38 GMT-0800 (PST)
Job j ran at: Sat Feb 24 2018 14:25:39 GMT-0800 (PST)
Job j ran at: Sat Feb 24 2018 14:25:40 GMT-0800 (PST)
Next invocation without cancellation should be at 2018-02-24T22:25:41.000Z
Job j ran at: Sat Feb 24 2018 14:25:41 GMT-0800 (PST)
Job j ran at: Sat Feb 24 2018 14:25:42 GMT-0800 (PST)
Job j ran at: Sat Feb 24 2018 14:25:43 GMT-0800 (PST)
Job j ran at: Sat Feb 24 2018 14:25:44 GMT-0800 (PST)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rijnhardcommented, Jun 5, 2018

Hi

Not to sound needy but if everything is ok can we get this merged? I’m going to be using this lib and need this functionality

1reaction
Freakspotcommented, May 16, 2018

Perfect, thanks for the fix!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Route cancellation · Issue #2476 · vercel/next.js - GitHub
Working on a editor app and need to be able to cancel route changes in case there are unsaved changes. I just ended...
Read more >
Unable to cancel next up upgrade - Community forums - AT&T
There are two steps. You have to cancel the program from your installment plan and then you have to call them to get...
Read more >
How to cancel next event calls? - javascript - Stack Overflow
I have an event "pointerdown" but I want it to cancel the event call when a certain condition is met in one of...
Read more >
Cancel Change UI Action not working - ServiceNow Community
Solved: Hello Experts, For some reason OOTB Cancel Change UI Action button is not working when clicked on it opens a dialog box...
Read more >
Cancel on next payment - WordPress.org
When I subscribe with a testing user to one of my subscriptions and then cancel the subscription afterwards, the user is not listed...
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