During shutdown the worker has been checking for error
and attempting to mark the job as failed if there was
an error. Sometimes an error occurs that does not result
in the job being terminated early, such as an undefined
variable. In that case, the job will already have been
marked as successful, but the registered shutdown function
has been also trying to mark it as a failure.
Instead of attempting to mark the job as a failure any
time an error occurs, only mark the job as a failure if
it has not already been acknowledged.
During shutdown the worker has been checking for error and attempting to mark the job as failed if there was an error. Sometimes an error occurs that does not result in the job being terminated early, such as an undefined variable. In that case, the job will already have been marked as successful, but the registered shutdown function has been also trying to mark it as a failure.
Instead of attempting to mark the job as a failure any time an error occurs, only mark the job as a failure if it has not already been acknowledged.