diff --git a/packages/nodes-base/nodes/CrateDb/CrateDb.node.ts b/packages/nodes-base/nodes/CrateDb/CrateDb.node.ts index 79cd22c8db..b0e6dab6c9 100644 --- a/packages/nodes-base/nodes/CrateDb/CrateDb.node.ts +++ b/packages/nodes-base/nodes/CrateDb/CrateDb.node.ts @@ -378,15 +378,15 @@ export class CrateDb implements INodeType { returnItems = this.helpers.returnJsonArray(getItemsCopy(items, columns)); } } 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]; } diff --git a/packages/nodes-base/nodes/Microsoft/Sql/MicrosoftSql.node.ts b/packages/nodes-base/nodes/Microsoft/Sql/MicrosoftSql.node.ts index f91a5dc9ad..7bbf15519a 100644 --- a/packages/nodes-base/nodes/Microsoft/Sql/MicrosoftSql.node.ts +++ b/packages/nodes-base/nodes/Microsoft/Sql/MicrosoftSql.node.ts @@ -440,7 +440,7 @@ export class MicrosoftSql implements INodeType { } } - // Close the connection + // shuts down the connection pool associated with the db object to allow the process to finish await pool.close(); const itemData = generatePairedItemData(items.length); diff --git a/packages/nodes-base/nodes/Postgres/PostgresTrigger.functions.ts b/packages/nodes-base/nodes/Postgres/PostgresTrigger.functions.ts index 9d6ea69c78..e27b863b42 100644 --- a/packages/nodes-base/nodes/Postgres/PostgresTrigger.functions.ts +++ b/packages/nodes-base/nodes/Postgres/PostgresTrigger.functions.ts @@ -112,19 +112,19 @@ export async function initDB(this: ITriggerFunctions | ILoadOptionsFunctions) { } export async function searchSchema(this: ILoadOptionsFunctions): Promise { - const { db, pgp } = await initDB.call(this); + const { db } = await initDB.call(this); const schemaList = await db.any('SELECT schema_name FROM information_schema.schemata'); const results: INodeListSearchItems[] = (schemaList as IDataObject[]).map((s) => ({ name: s.schema_name as string, value: s.schema_name as string, })); - pgp.end(); + await db.$pool.end(); return { results }; } export async function searchTables(this: ILoadOptionsFunctions): Promise { const schema = this.getNodeParameter('schema', 0) as IDataObject; - const { db, pgp } = await initDB.call(this); + const { db } = await initDB.call(this); let tableList = []; try { tableList = await db.any( @@ -138,6 +138,6 @@ export async function searchTables(this: ILoadOptionsFunctions): Promise