fix: Do not attempt to save statistics data for unsaved workflows (#5106)

* fix: Do not attempt to save data for unsaved workflows
This commit is contained in:
Omar Ajoue 2023-01-09 12:49:27 +01:00 committed by GitHub
parent 47e32e4268
commit a43e3e4112
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,7 +24,7 @@ export async function workflowExecutionCompleted(
// Get the workflow id
const workflowId = workflowData.id;
if (workflowId === undefined) return;
if (!workflowId) return;
// Try insertion and if it fails due to key conflicts then update the existing entry instead
try {
@ -59,7 +59,11 @@ export async function workflowExecutionCompleted(
}
}
export async function nodeFetchedData(workflowId: string, node: INode): Promise<void> {
export async function nodeFetchedData(
workflowId: string | undefined | null,
node: INode,
): Promise<void> {
if (!workflowId) return;
// Try to insert the data loaded statistic
try {
await Db.collections.WorkflowStatistics.insert({