diff --git a/src/modules/connection-test/connection-test.service.ts b/src/modules/connection-test/connection-test.service.ts index 53218ce..e25aa75 100644 --- a/src/modules/connection-test/connection-test.service.ts +++ b/src/modules/connection-test/connection-test.service.ts @@ -89,13 +89,15 @@ export class ConnectionTestService { plugin, }), ).catch(async (e) => { - await this.connectionsService.deleteConnection({ - body: { id: connection_id }, - info: { customer_id, customer_name, user_id }, - }); + if (!body.connection_id) { + await this.connectionsService.deleteConnection({ + body: { id: connection_id }, + info: { customer_id, customer_name, user_id }, + }); + } throw e; }); - if (!operation_result) { + if (!operation_result && !body.connection_id) { await this.connectionsService.deleteConnection({ body: { id: connection_id }, info: { customer_id, customer_name, user_id },