mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 06:34:05 -08:00
fix(core): Add logs and error catches for possible failures in queue mode (#3032)
This commit is contained in:
parent
f6aa8f2196
commit
3b4a97dd57
|
@ -119,9 +119,14 @@ export class Worker extends Command {
|
|||
|
||||
async runJob(job: Bull.Job, nodeTypes: INodeTypes): Promise<IBullJobResponse> {
|
||||
const jobData = job.data as IBullJobData;
|
||||
const executionDb = (await Db.collections.Execution!.findOne(
|
||||
jobData.executionId,
|
||||
)) as IExecutionFlattedDb;
|
||||
const executionDb = await Db.collections.Execution!.findOne(jobData.executionId);
|
||||
|
||||
if (!executionDb) {
|
||||
LoggerProxy.error('Worker failed to find execution data in database. Cannot continue.', {
|
||||
executionId: jobData.executionId,
|
||||
});
|
||||
throw new Error('Unable to find execution data in database. Aborting execution.');
|
||||
}
|
||||
const currentExecutionDb = ResponseHelper.unflattenExecutionData(executionDb);
|
||||
LoggerProxy.info(
|
||||
`Start job: ${job.id} (Workflow ID: ${currentExecutionDb.workflowData.id} | Execution: ${jobData.executionId})`,
|
||||
|
@ -139,6 +144,13 @@ export class Worker extends Command {
|
|||
findOptions,
|
||||
);
|
||||
if (workflowData === undefined) {
|
||||
LoggerProxy.error(
|
||||
'Worker execution failed because workflow could not be found in database.',
|
||||
{
|
||||
workflowId: currentExecutionDb.workflowData.id,
|
||||
executionId: jobData.executionId,
|
||||
},
|
||||
);
|
||||
throw new Error(
|
||||
`The workflow with the ID "${currentExecutionDb.workflowData.id}" could not be found`,
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue