mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
⚡ Add logging for pruning errors
This commit is contained in:
parent
38f0cc1a8f
commit
65e6d7c0f8
|
@ -102,7 +102,7 @@ function executeErrorWorkflow(workflowData: IWorkflowBase, fullRunData: IRun, mo
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
let throttling = false;
|
let throttling = false;
|
||||||
function pruneExecutionData(): void {
|
function pruneExecutionData(this: WorkflowHooks): void {
|
||||||
if (!throttling) {
|
if (!throttling) {
|
||||||
Logger.verbose('Pruning execution data from database');
|
Logger.verbose('Pruning execution data from database');
|
||||||
|
|
||||||
|
@ -118,7 +118,11 @@ function pruneExecutionData(): void {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
throttling = false;
|
throttling = false;
|
||||||
}, timeout * 1000)
|
}, timeout * 1000)
|
||||||
).catch(err => throttling = false);
|
).catch(error => {
|
||||||
|
throttling = false;
|
||||||
|
|
||||||
|
Logger.error(`Failed pruning execution data from database for execution ID ${this.executionId} (hookFunctionsSave)`, { ...error, executionId: this.executionId, sessionId: this.sessionId, workflowId: this.workflowData.id });
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,7 +326,7 @@ function hookFunctionsSave(parentProcessMode?: string): IWorkflowExecuteHooks {
|
||||||
|
|
||||||
// Prune old execution data
|
// Prune old execution data
|
||||||
if (config.get('executions.pruneData')) {
|
if (config.get('executions.pruneData')) {
|
||||||
pruneExecutionData();
|
pruneExecutionData.call(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
const isManualMode = [this.mode, parentProcessMode].includes('manual');
|
const isManualMode = [this.mode, parentProcessMode].includes('manual');
|
||||||
|
@ -387,9 +391,9 @@ function hookFunctionsSave(parentProcessMode?: string): IWorkflowExecuteHooks {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Leave log message before flatten as that operation increased memory usage a lot and the chance of a crash is highest here
|
// Leave log message before flatten as that operation increased memory usage a lot and the chance of a crash is highest here
|
||||||
Logger.debug(`Save execution data to database for execution ID ${this.executionId}`, {
|
Logger.debug(`Save execution data to database for execution ID ${this.executionId}`, {
|
||||||
executionId: this.executionId,
|
executionId: this.executionId,
|
||||||
workflowId: this.workflowData.id,
|
workflowId: this.workflowData.id,
|
||||||
finished: fullExecutionData.finished,
|
finished: fullExecutionData.finished,
|
||||||
stoppedAt: fullExecutionData.stoppedAt,
|
stoppedAt: fullExecutionData.stoppedAt,
|
||||||
});
|
});
|
||||||
|
@ -409,12 +413,12 @@ function hookFunctionsSave(parentProcessMode?: string): IWorkflowExecuteHooks {
|
||||||
executeErrorWorkflow(this.workflowData, fullRunData, this.mode, this.executionId, this.retryOf);
|
executeErrorWorkflow(this.workflowData, fullRunData, this.mode, this.executionId, this.retryOf);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(`Failed saving execution data to DB on execution ID ${this.executionId}`, {
|
Logger.error(`Failed saving execution data to DB on execution ID ${this.executionId}`, {
|
||||||
executionId: this.executionId,
|
executionId: this.executionId,
|
||||||
workflowId: this.workflowData.id,
|
workflowId: this.workflowData.id,
|
||||||
error,
|
error,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!isManualMode) {
|
if (!isManualMode) {
|
||||||
executeErrorWorkflow(this.workflowData, fullRunData, this.mode, undefined, this.retryOf);
|
executeErrorWorkflow(this.workflowData, fullRunData, this.mode, undefined, this.retryOf);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue