Are Fire&Forget Jobs ran at each AppPool recycle?

Hello,
I am wondering if the Fire & Forget jobs are run each time the application is started?
I am not sure if the fire and forget jobs are not executed only once, but also when I restart application, refresh app pool, deploy new version of app (this is somehow logical).

Is this correct?

Or Hangfire notes in its database, that this job was already executed once and it does not try to run it again?

Thank you

Fire and Forget jobs are executed once and only once.

What happens if F&F job (a long one) was not completed, due to AppPool recycle or any other outage with a container the next time Hangfire server instance is started? Will this unfinished job be picked up again and run?

Yes. Which is why its importan jobs are written in way that handles this case… either by not having sideeffects of being run multiple times, or in some other way keep internal track of progress so ie. the same notification emails arent sent to the same recipients multiple times.

1 Like