mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-02 07:01:30 -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> {
|
async runJob(job: Bull.Job, nodeTypes: INodeTypes): Promise<IBullJobResponse> {
|
||||||
const jobData = job.data as IBullJobData;
|
const jobData = job.data as IBullJobData;
|
||||||
const executionDb = (await Db.collections.Execution!.findOne(
|
const executionDb = await Db.collections.Execution!.findOne(jobData.executionId);
|
||||||
jobData.executionId,
|
|
||||||
)) as IExecutionFlattedDb;
|
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);
|
const currentExecutionDb = ResponseHelper.unflattenExecutionData(executionDb);
|
||||||
LoggerProxy.info(
|
LoggerProxy.info(
|
||||||
`Start job: ${job.id} (Workflow ID: ${currentExecutionDb.workflowData.id} | Execution: ${jobData.executionId})`,
|
`Start job: ${job.id} (Workflow ID: ${currentExecutionDb.workflowData.id} | Execution: ${jobData.executionId})`,
|
||||||
|
@ -139,6 +144,13 @@ export class Worker extends Command {
|
||||||
findOptions,
|
findOptions,
|
||||||
);
|
);
|
||||||
if (workflowData === undefined) {
|
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(
|
throw new Error(
|
||||||
`The workflow with the ID "${currentExecutionDb.workflowData.id}" could not be found`,
|
`The workflow with the ID "${currentExecutionDb.workflowData.id}" could not be found`,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue