fix: create rabbitmq queues on set config

This commit is contained in:
Davidson Gomes 2023-08-31 17:10:19 -03:00
parent 3ea454c7ed
commit 6eda556242
2 changed files with 2 additions and 4 deletions

View File

@ -44,7 +44,7 @@ export const getAMQP = (): amqp.Channel | null => {
export const initQueues = (instanceName: string, events: string[]) => {
console.log('initQueues', instanceName, events);
if (!events.length) return;
if (!events || !events.length) return;
const queues = events.map((event) => {
return `${event.replace(/_/g, '.').toLowerCase()}`;

View File

@ -229,7 +229,7 @@ export class InstanceController {
'CHAMA_AI_ACTION',
];
} else {
newEvents = events;
newEvents = rabbitmq_events;
}
this.rabbitmqService.create(instance, {
enabled: true,
@ -237,8 +237,6 @@ export class InstanceController {
});
rabbitmqEvents = (await this.rabbitmqService.find(instance)).events;
initQueues(instance.instanceName, rabbitmqEvents);
} catch (error) {
this.logger.log(error);
}