Browse Source

Merge pull request #6743 from nocodb/nc-fix/test-conn

fix: better connection handling for test connection
pull/6749/head
Pranav C 1 year ago committed by GitHub
parent
commit
3303fa82d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      packages/nocodb/src/controllers/utils.controller.ts
  2. 7
      packages/nocodb/src/db/sql-mgr/v2/SqlMgrv2.ts

5
packages/nocodb/src/controllers/utils.controller.ts

@ -45,6 +45,11 @@ export class UtilsController {
}) })
@HttpCode(200) @HttpCode(200)
async testConnection(@Body() body: any) { async testConnection(@Body() body: any) {
body.pool = {
min: 0,
max: 1,
};
return await this.utilsService.testConnection({ body }); return await this.utilsService.testConnection({ body });
} }

7
packages/nocodb/src/db/sql-mgr/v2/SqlMgrv2.ts

@ -36,7 +36,12 @@ export default class SqlMgrv2 {
public static async testConnection(args = {}) { public static async testConnection(args = {}) {
const client = await SqlClientFactory.create(args); const client = await SqlClientFactory.create(args);
return client.testConnection(); const result = await client.testConnection();
// close connection
await client.knex.destroy();
return result;
} }
/** /**

Loading…
Cancel
Save