From c1e09d03054a444022f9777abde4455f1f8a9d8c Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 13 Jun 2023 10:49:09 +0100 Subject: [PATCH] Close client on testconnection --- packages/server/src/integrations/mongodb.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/server/src/integrations/mongodb.ts b/packages/server/src/integrations/mongodb.ts index 417aa61f41..f076536344 100644 --- a/packages/server/src/integrations/mongodb.ts +++ b/packages/server/src/integrations/mongodb.ts @@ -351,7 +351,7 @@ const SCHEMA: Integration = getSchema() class MongoIntegration implements IntegrationBase { private config: MongoDBConfig - private client: any + private client: MongoClient constructor(config: MongoDBConfig) { this.config = config @@ -372,6 +372,8 @@ class MongoIntegration implements IntegrationBase { response.connected = true } catch (e: any) { response.error = e.message as string + } finally { + await this.client.close() } return response } @@ -380,7 +382,7 @@ class MongoIntegration implements IntegrationBase { return this.client.connect() } - createObjectIds(json: any): object { + createObjectIds(json: any) { const self = this function interpolateObjectIds(json: any) { for (let field of Object.keys(json)) {