fix(Postgres Node): Re-use connection pool across executions (#12346)

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Danny Martini
2024-12-27 08:15:37 +00:00
committed by GitHub
parent 7b2630d1a0
commit 2ca37f5f7f
10 changed files with 504 additions and 200 deletions

View File

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