diff --git a/CHANGELOG.md b/CHANGELOG.md index e1bd69a9..d661a3ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ * Fix buildkey function in hSet and hDelete * Fix mexico number * Update baileys version +* Update in Baileys version that fixes timeout when updating profile picture +* Adjusts for fix timeout error on send status message # 2.1.1 (2024-09-22 10:31) diff --git a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts index 5d30ff6a..7ba56ad9 100644 --- a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts +++ b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts @@ -1741,9 +1741,25 @@ export class BaileysStartupService extends ChannelStartupService { } if (sender === 'status@broadcast') { - const jidList = message['status'].option.statusJidList; + let jidList; + if (message['status'].option.allContacts) { + const contacts = await this.prismaRepository.contact.findMany({ + where: { + instanceId: this.instanceId, + remoteJid: { + not: { + endsWith: '@g.us', + }, + }, + }, + }); - const batchSize = 500; + jidList = contacts.map((contact) => contact.remoteJid); + } else { + jidList = message['status'].option.statusJidList; + } + + const batchSize = 10; const batches = Array.from({ length: Math.ceil(jidList.length / batchSize) }, (_, i) => jidList.slice(i * batchSize, i * batchSize + batchSize),