mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-20 12:22:21 -06:00
chore: Update monitor service and instance controller
Refactored the instance controller and monitor service to improve the connection handling and management of WhatsApp instances. - Modified the instance controller to close the WebSocket connection and restart the instance instead of reloading it. - Updated the monitor service to remove the instance from the `waInstances` object and emit an event to clean up and remove the instance data. - Fixed an issue where the instance was not being removed from the `waInstances` object. Files affected: - CHANGELOG.md - src/api/controllers/instance.controller.ts - src/api/services/monitor.service.ts
This commit is contained in:
@@ -336,18 +336,18 @@ export class WAMonitoringService {
|
||||
|
||||
private removeInstance() {
|
||||
this.eventEmitter.on('remove.instance', async (instanceName: string) => {
|
||||
try {
|
||||
this.waInstances[instanceName] = undefined;
|
||||
} catch (error) {
|
||||
this.logger.error(error);
|
||||
}
|
||||
|
||||
try {
|
||||
this.cleaningUp(instanceName);
|
||||
this.cleaningStoreData(instanceName);
|
||||
} finally {
|
||||
this.logger.warn(`Instance "${instanceName}" - REMOVED`);
|
||||
}
|
||||
|
||||
try {
|
||||
delete this.waInstances[instanceName];
|
||||
} catch (error) {
|
||||
this.logger.error(error);
|
||||
}
|
||||
});
|
||||
this.eventEmitter.on('logout.instance', async (instanceName: string) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user