I’m very interested in using Hangfire in our project and I was wondering if there is an execution timeout when executing a “Fire and forget” job type.
If the job is not finished in a certain elapse of time is it stopped by Hangfire ?
Thank you for your answer.
As I haven’t received any answers maybe be I can explain more about what we are trying to accomplish.
The idea is to launch a fire and forget job which starts an event subscription that awaits for new incoming messages coming from an external source.
The job will run indefinitely and can be stopped manually or when the host service is stopped. We can have several subscriptions in parallel on different sources which can be added dynamically via a http request to a web API.
We were thinking about having a job per subscription and manage it via a fire and forget job?
We also know that hangfire provides the IBackgroundProcess interface for implementing long running tasks but if I understand correctly the background process are initiated at the job creation and there is no way of adding background processes dynamically at each subscription request for example? Is it right?
So that’s the reason of my first question is there a timeout in executing a fire and forget job? Or the job can run indefinitely?
Thanks everyone for reading and answers.
The short answer, is no. If you wanted hangfire to stop your job, you would need to make your job cancelable. And if you’re doing that, then just take care of the timeout within your job itself
Use CancellationToken in your job.