I’ve successfully configured Hangfire in an Azure worker role. It runs super fine except when the running task is very long. It repeats itself every 2h on average.
I’ve set the InvisibilityTimeout for SqlServerStorageOptions to TimeSpan.FromHours(24) without any luck.
Is there any other timeout that I’m missing?
i’m running the same kind of problem (out of azure)
i’ve switched to cmdline hosting for the task , it’s better , but still the task get restarted while running (every 30 min or so).
each time on a different worker #.
is there a limit for running task ? mine could take severals hours .
I solved the issue by including code in the task to make it reentrant safe. What I actually did was to set a flag at the end of processing so the next time Hangfire tried to execute it again, the flag was set and it actually ended the job.
When I did this, it stopped executing multiple times.
ok then … i will look at this reentrance thing .
but did it not re-launch , or didi you just test the flag at the start of your task , then ended if set ?
because how this could work if i’v got multiple servers hosting the task ?
thanks anyway , i’ll look in this direction.
i’ve found a DisableConcurrentExecution attribut ? any chance it serve the purpose ?
Can you show an example of your reentrant safe code please?
Hello Can anyone show a sample code for configuring Hangfire in Worker Role ?
Hello @josecta, can you show a sample code for configuring Hangfire in Worker Role from scratch ?