Skip to content

Commit 9f1003e

Browse files
committed
rabbitmq
1 parent 73c0039 commit 9f1003e

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/whatsapp/services/whatsapp.baileys.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ export class BaileysStartupService extends WAStartupService {
472472
if (this.localProxy.enabled) {
473473
this.logger.info('Proxy enabled: ' + this.localProxy.proxy);
474474

475-
if (this.localProxy.proxy.host.includes('proxyscrape')) {
475+
if (this.localProxy?.proxy?.host?.includes('proxyscrape')) {
476476
try {
477477
const response = await axios.get(this.localProxy.proxy.host);
478478
const text = response.data;

src/whatsapp/services/whatsapp.service.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,18 @@ export class WAStartupService {
663663
};
664664
}
665665

666+
private assertExchangeAsync = (channel, exchangeName, exchangeType, options) => {
667+
return new Promise((resolve, reject) => {
668+
channel.assertExchange(exchangeName, exchangeType, options, (error, ok) => {
669+
if (error) {
670+
reject(error);
671+
} else {
672+
resolve(ok);
673+
}
674+
});
675+
});
676+
};
677+
666678
public async sendDataWebhook<T = any>(event: Events, data: T, local = true) {
667679
const webhookGlobal = this.configService.get<Webhook>('WEBHOOK');
668680
const webhookLocal = this.localWebhook.events;
@@ -687,7 +699,12 @@ export class WAStartupService {
687699
if (Array.isArray(rabbitmqLocal) && rabbitmqLocal.includes(we)) {
688700
const exchangeName = this.instanceName ?? 'evolution_exchange';
689701

690-
await amqp.assertExchange(exchangeName, 'topic', {
702+
// await amqp.assertExchange(exchangeName, 'topic', {
703+
// durable: true,
704+
// autoDelete: false,
705+
// });
706+
707+
await this.assertExchangeAsync(amqp, exchangeName, 'topic', {
691708
durable: true,
692709
autoDelete: false,
693710
});

0 commit comments

Comments
 (0)