I have a job, which is recurring task. The nature of the task requires that I use BackgroundJob.Schedule and then pass on a new BackgroundJob.Schedule when the previous is completed.
These tasks run for several minutes.
If a task is invoked by user (not in hangfire dashboard) any already running task must be cancelled.
Today (before hangfire) I use the CancellationToken passed on to the job to stop it. Can I do something similar in HangFire ?
It would be nice if BackgroundJob.Delete() cancelled the running job using CanellationToken. If so: does it wait until the process has completed?
Or if I activate canellation on the CancellationToken passed on to the job? Will it terminate? I assume that it is serialized when BackgroundJob.Schedule is called…
Thanks in advance
Kind Regards
Soeren