Fix events structure to prevent "Instance not found" exception

This commit is contained in:
Stênio Aníbal 2024-08-21 14:55:18 -03:00
parent 475fced33b
commit 6585e8f0c2
5 changed files with 12 additions and 10 deletions

View File

@ -52,6 +52,8 @@ export class InstanceController {
const instanceId = v4();
instanceData.instanceId = instanceId;
let hash: string;
if (!instanceData.token) hash = v4().toUpperCase();
@ -75,16 +77,16 @@ export class InstanceController {
businessId: instanceData.businessId,
});
instance.sendDataWebhook(Events.INSTANCE_CREATE, {
instanceName: instanceData.instanceName,
instanceId: instanceId,
});
this.waMonitor.waInstances[instance.instanceName] = instance;
this.waMonitor.delInstanceTime(instance.instanceName);
// set events
eventController.setInstance(instance.instanceName, instanceData);
await eventController.setInstance(instance.instanceName, instanceData);
instance.sendDataWebhook(Events.INSTANCE_CREATE, {
instanceName: instanceData.instanceName,
instanceId: instanceId,
});
if (instanceData.proxyHost && instanceData.proxyPort && instanceData.proxyProtocol) {
const testProxy = await this.proxyService.testProxy({

View File

@ -102,7 +102,7 @@ export class RabbitmqController extends EventController {
});
if (!data) {
return null;
throw new NotFoundException('Instance websocket not found');
}
return data;

View File

@ -88,7 +88,7 @@ export class SqsController extends EventController {
});
if (!data) {
return null;
throw new NotFoundException('Instance websocket not found');
}
return data;

View File

@ -62,7 +62,7 @@ export class WebhookController extends EventController {
});
if (!data) {
return null;
throw new NotFoundException('Instance websocket not found');
}
return data;

View File

@ -99,7 +99,7 @@ export class WebsocketController extends EventController {
});
if (!data) {
return null;
throw new NotFoundException('Instance websocket not found');
}
return data;