From ec1e3fdf4131c992ba0b5fe665a2114df7d68895 Mon Sep 17 00:00:00 2001 From: ShootingStar91 Date: Thu, 22 Aug 2024 22:00:38 +0300 Subject: [PATCH] Write: Skip logging if nothing was written --- backend/src/services/write/write.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/src/services/write/write.ts b/backend/src/services/write/write.ts index 0c32d4d2..f7f8c00a 100644 --- a/backend/src/services/write/write.ts +++ b/backend/src/services/write/write.ts @@ -180,7 +180,9 @@ export const write: WriteFunction = async (data, tableName, userInitials, commen const id = await writeTable(data, tableName, writeContext) writeContext.writeList = writeContext.writeList.filter(item => !tablesToNotLog.includes(item.table)) debugLog(`WriteList: ${printJSON(writeContext.writeList)}`) - await logAllUpdates(writeContext, tableName, userInitials, comment, id, references) + if (writeContext.writeList.length > 0) { + await logAllUpdates(writeContext, tableName, userInitials, comment, id, references) + } await connection.commit() await connection.end() return id