Skip to content

Commit

Permalink
bug fix: do not remove instance in "no.connection" event
Browse files Browse the repository at this point in the history
  • Loading branch information
jrCleber committed Sep 6, 2023
1 parent 2d5ffc0 commit fd54b99
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/whatsapp/services/monitor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,20 @@ export class WAMonitoringService {

private noConnection() {
this.eventEmitter.on('no.connection', async (instanceName) => {
try {
this.waInstances[instanceName] = undefined;
this.cleaningUp(instanceName);
} catch (error) {
this.logger.error({
localError: 'noConnection',
warn: 'Error deleting instance from memory.',
error,
});
} finally {
this.logger.warn(`Instance "${instanceName}" - NOT CONNECTION`);
const del = this.configService.get<DelInstance>('DEL_INSTANCE');
if(del) {
try {
this.waInstances[instanceName] = undefined;
this.cleaningUp(instanceName);
} catch (error) {
this.logger.error({
localError: 'noConnection',
warn: 'Error deleting instance from memory.',
error,
});
} finally {
this.logger.warn(`Instance "${instanceName}" - NOT CONNECTION`);
}
}
});
}
Expand Down

0 comments on commit fd54b99

Please sign in to comment.