fix(core): Pg-promise de-initialization fix (#7417)

Github issue / Community forum post (link here to close automatically):

https://community.n8n.io/t/postgres-node-called-end-on-pool-more-than-once/30585/1
This commit is contained in:
Michael Kret
2023-10-12 12:10:14 +03:00
committed by GitHub
parent 2b6a15e478
commit 77039044eb
7 changed files with 20 additions and 20 deletions

View File

@@ -323,7 +323,7 @@ export class PostgresV1 implements INodeType {
const db = pgp(config);
await db.connect();
pgp.end();
await db.$pool.end();
} catch (error) {
return {
status: 'Error',
@@ -412,15 +412,15 @@ export class PostgresV1 implements INodeType {
returnItems = wrapData(updateItems);
} else {
pgp.end();
await db.$pool.end();
throw new NodeOperationError(
this.getNode(),
`The operation "${operation}" is not supported!`,
);
}
// Close the connection
pgp.end();
// shuts down the connection pool associated with the db object to allow the process to finish
await db.$pool.end();
return [returnItems];
}