From e7f00bcb7f2dce66ca07a9322d50f96356c1a43d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Fri, 17 Jan 2025 14:58:19 +0100 Subject: [PATCH] fix(Postgres Chat Memory Node): Do not terminate the connection pool (#12674) --- .../memory/MemoryPostgresChat/MemoryPostgresChat.node.ts | 5 ----- packages/nodes-base/nodes/Postgres/transport/index.ts | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/@n8n/nodes-langchain/nodes/memory/MemoryPostgresChat/MemoryPostgresChat.node.ts b/packages/@n8n/nodes-langchain/nodes/memory/MemoryPostgresChat/MemoryPostgresChat.node.ts index 8c46d2a5e2..81be577f79 100644 --- a/packages/@n8n/nodes-langchain/nodes/memory/MemoryPostgresChat/MemoryPostgresChat.node.ts +++ b/packages/@n8n/nodes-langchain/nodes/memory/MemoryPostgresChat/MemoryPostgresChat.node.ts @@ -115,12 +115,7 @@ export class MemoryPostgresChat implements INodeType { ...kOptions, }); - async function closeFunction() { - void pool.end(); - } - return { - closeFunction, response: logWrapper(memory, this), }; } diff --git a/packages/nodes-base/nodes/Postgres/transport/index.ts b/packages/nodes-base/nodes/Postgres/transport/index.ts index 990229a379..71684ddf95 100644 --- a/packages/nodes-base/nodes/Postgres/transport/index.ts +++ b/packages/nodes-base/nodes/Postgres/transport/index.ts @@ -186,7 +186,7 @@ export async function configurePostgres( nodeVersion: options.nodeVersion as unknown as string, fallBackHandler, cleanUpHandler: async ({ db }) => { - await db.$pool.end(); + if (!db.$pool.ended) await db.$pool.end(); }, }); }