-
-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Labels
Description
Right now, this code in the ExecutorManager is not dealing with unknown errors or cancels:
try {
logger("Executor Manager").debug(`Running job ${job.id} in queue ${queueConfig.name}`);
const result = await this.runnerPool.run(job, signal);
isRunning = false;
logger("Executor Manager").debug(`Job ${job.id} completed with result: ${JSON.stringify(result)}`);
const transition = JobTransitionFactory.create(result);
await JobTransitioner.apply(this.backend, job, transition);
} catch (error: unknown) {
isRunning = false;
const err = error as Error;
if (err.message === "The task has been aborted") {
logger("Executor Manager").debug(`Job ${job.id} was canceled`);
} else {
logger("Executor Manager").error(`Error executing job ${job.id}: ${err.message}`);
throw error;
}
} finally {
isRunning = false;
this.activeByQueue[queueConfig.name].delete(job.id);
this.activeJobs.delete(job.id);
}
Sometimes, if there is an unhandled error in a promise (that does not reject), the perform
method from a job does not catch it and does not create a retry transition.
We need to:
- Catch unhandled errors in
perform
and return the correct transition - Deal with unknown errors in the executor-manager
- Deal with cancellation on executor-manager