[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canceling jobs #1564

Open
AidasPa opened this issue Dec 28, 2023 · 2 comments
Open

Canceling jobs #1564

AidasPa opened this issue Dec 28, 2023 · 2 comments

Comments

@AidasPa
Copy link
AidasPa commented Dec 28, 2023

Couldn't find any more information on this anywhere - how do I reliably cancel recurring (manually set) jobs?

I have a job called recurring_payment, and once the user cancels their plan, it has to cancel the chain of recurring jobs as well.
However, on cancel, the job runner throws an error:

Error: job <id> (name: recurring_payment) cannot be updated in the database, maybe it does not exist anymore?

In essence, the job works like this: get current period end, add + 30 days to it and schedule another job, with the same arguments at the current period end date.

@AidasPa
Copy link
Author
AidasPa commented Dec 28, 2023

I guess the solution would be to just remove this:

        if (!result.acknowledged || result.matchedCount !== 1) {
            throw new Error(`job ${id} (name: ${job.attrs.name}) cannot be updated in the database, maybe it does not exist anymore?`);
        }

@AidasPa
Copy link
Author
AidasPa commented Dec 28, 2023

I assume this just happens whenever you cancel a job that is currently in progress..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant