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.
@hometoast thanks for message this answers my question I wanted to be sure that there is no internal hangfire timeout that stops the job automatically.
Thanks @bigB we are using CancellationToken to control job stop for example during service stop.
It seems that there is a worker time out around 30 minutes. In my case I have the following message:
Job 1 was aborted on worker after approximately 30 minutes.
Is there any way to disable this timeout ?
Thank you .