fix: timeout error on send status message

This commit is contained in:
Davidson Gomes 2024-10-03 17:22:52 -03:00
parent 23549e3c1f
commit 88c1830bf5
2 changed files with 20 additions and 2 deletions

View File

@ -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)

View File

@ -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),