Open crawdell opened 6 years ago
It has probably succeeded before you changed the method signature, so it is listed under the Succeeded page. Now that you've changed the signature, it cannot find the previous method definition, so it shows the error. But it doesn't change the fact the job was successfully executed before, so I don't see any contradictions here.
I don't think that was the issue. Here's the order of things that I think happened:
The job detail has fallen off the success list so I can't go back and look. If I have time I might test this again to be sure I track the steps. I want to be extra sure that if a job can't run because the method has changed that it goes to "failed"
I'm using beta so I know there might be issues. Maybe someone else has seen this?
Job cannot run again on Cron schedule if you change the method signature without updating the recurring job definition itself (RecurringJob.AddOrUpdate(...)
).
Job details page uses reflection to show method invocation, so it is perfectly normal for it to not find the target method if the signature was changed. Even if the job was successfully executed before.
I still don't see any issue here.
I thought I saw this too but it is actually the way @pieceofsummer describes: the job ran successfully when the method was still there. When the method disappears, the recurring job will not trigger at all (in 1.6.19), so it won't appear in Succeeded or Failed or anywhere else. Recurring job list just shows "next execution: X minutes ago".
I'm thinking that the visibility of this situation is currently less than ideal. Perhaps the recurring job counter needs to turn red if a recurring job is unable to start on schedule?
I'm definitely seeing this problem right now on 1.8.3.
I have to specifically go into "Recurring Jobs" to see that it's actually failing.
There it says "Last execution: 27 minutes ago" and "Next execution: ERROR", but it is (as you can see on the first screenshot) actually still trying to execute jobs
I had changed the method and method signature of a Recurring job that was already in Hangfire. When the recurring job tried to run it could not because the method required a different set of arguments. But the job was still listed on the Succeeded list
On the job list it looked like:
58 | Can not find the target method. | 5.520s | 7 hours ago
On the job detail it said: // Job ID: #58 Can not find the target method.
On the Recurring job page there was an error message on the Job column for the job. I didn't get the exact message but it was something like "method with signature xxxxxx was not found" or something along those lines.
The key thing here is this kind of thing should cause the job to fail and be listed in the Failed listing so we can catch these things and fix.
Thanks for 1.7.0 Beta. It really is a great improvement.