Hi, I’m trying to find a way to cancel the current execution of a recurring job.
I’ve already tested BackgroundJob.Delete() and this correctly throws a JobAbortedException within a job that is currently executing as long as it invokes ThrowIfCancellationRequested() on its cancellation token.
However, calling RecurringJob.RemoveIfExists() only deletes the recurring job definition, and doesn’t cancel any running background jobs that were created from the recurring job definition.
Basically I need a way to be able to lookup any background jobs that are associated with a recurring job, and manually cancel them using the Delete() method. However, I don’t know how to do this or if it is even possible.
Can anyone provide any help please?