mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
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:
@@ -112,19 +112,19 @@ export async function initDB(this: ITriggerFunctions | ILoadOptionsFunctions) {
|
||||
}
|
||||
|
||||
export async function searchSchema(this: ILoadOptionsFunctions): Promise<INodeListSearchResult> {
|
||||
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<INodeListSearchResult> {
|
||||
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<INodeLi
|
||||
name: s.table_name as string,
|
||||
value: s.table_name as string,
|
||||
}));
|
||||
pgp.end();
|
||||
await db.$pool.end();
|
||||
return { results };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user