You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a job throws an exception, Quartz will typically immediately re-execute it, meaning the job can and likely will throw the same exception again.
Is this actually true? I've been both testing this and reading the code, and it seems that when an exception occurs, the JobRunShell converts it to JobExecutionException with refireImmediately: false:
logger.LogError(e,"Job {JobDetailKey} threw an unhandled Exception: ", jobDetail.Key);
SchedulerExceptionse=new SchedulerException("Job threw an unhandled exception.", e);
stringmsg=$"Job {jec.JobDetail.Key} threw an exception.";
await qs.NotifySchedulerListenersError(msg, se, cancellationToken).ConfigureAwait(false);
jobExEx=new JobExecutionException(se,false);
}
The exception without refire will get converted to scheduler instruction (refireImmediately: false will convert to SchedulerInstruction.NoInstruction):
This then means that the fired trigger will be marked as completed and no re-execution will happen. This is the opposite to what the documentation says.
Is this indended behavior? If yes, I think the documentation should be fixed. What do you think?
Thanks.
The text was updated successfully, but these errors were encountered:
tompazourek
changed the title
Re-execute after throwing exception in docs
Re-execute after throwing exception incorrect docs
Mar 22, 2024
Hi, I'm reading the docs (https://www.quartz-scheduler.net/documentation/best-practices.html#throwing-exceptions) and it contains this:
Is this actually true? I've been both testing this and reading the code, and it seems that when an exception occurs, the
JobRunShell
converts it toJobExecutionException
withrefireImmediately: false
:quartznet/src/Quartz/Core/JobRunShell.cs
Lines 222 to 230 in fe5420a
The exception without refire will get converted to scheduler instruction (
refireImmediately: false
will convert toSchedulerInstruction.NoInstruction
):quartznet/src/Quartz/Impl/Triggers/AbstractTrigger.cs
Lines 435 to 457 in fe5420a
This then means that the fired trigger will be marked as completed and no re-execution will happen. This is the opposite to what the documentation says.
Is this indended behavior? If yes, I think the documentation should be fixed. What do you think?
Thanks.
The text was updated successfully, but these errors were encountered: