HangfireIO / Hangfire

An easy way to perform background job processing in .NET and .NET Core applications. No Windows Service or separate process required
https://www.hangfire.io
Other
9.44k stars 1.71k forks source link

Recurring Job triggers on Update #2381

Closed twojnarowski closed 7 months ago

twojnarowski commented 8 months ago

The situation sounds similar to: https://github.com/HangfireIO/Hangfire/issues/728 and https://github.com/HangfireIO/Hangfire/issues/1797

I am using Hangfire 1.8.10 currently and I had a bit similar situation. However I haven't changed cron, I changed the job itself. This is what happened:

I have no idea right now how to verify whether the job running was caused because the job failed and didn't run, so the last execution time was over 24 hours ago, so it did trigger to run that failed execution "ASAP" (and that is a feature / expected behavior) or was it triggered as a bug, just because the insides of the recurring job changed...

odinserj commented 7 months ago

Thank you for the detailed description. I have just completed refactoring for recurring jobs to make them look clean, simple and avoid side effects. As a bonus result, the described problem is gone 😊

twojnarowski commented 7 months ago

I just noticed something as a follow-up to this topic, but I'm not sure if that's an issue or a feature. I am now on 1.8.10 of Hangfire. When I have posted an update on the server, refactoring some jobs, then my code that runs for each recurring job AddOrUpdates at the start of the app, everything works, but in the Jobs listing, these jobs that have been modified, don't show the name of the function, but "Can not find the target method" instead. So When I go into details of a Job, under State I see "Succeeded" but on top of the page I get a yellow warning saying "Can not find the target method." So just the displaying of the name of the functions that were run when the function was in a different file doesn't work.

I will update to 1.8.12 soon and see if the history of jobs still gets corrupted after a job is changed.