Open CSFelix opened 1 month ago
add cache and no request every time groupMetadata
add cache and no request every time groupMetadata
Even though not using groupMetadata
, the issue remains
I dived into the problem and I found out where the error is happening:
./Socket/messages-send file - when I send messages to groups, it calls relayMessage
function that, consequently, calls await groupMetadata(jid)
function when the chat is a group. So, when sending a bunch of messages in a short period of time in groups, relayMessage()-groupMetadata() is called multiple times over the short period and then rate-overlimit
is triggered;
./Socket/group file - getting into groupMetadata(), I found out the problem is into groupQuery
function that calls query
function
./Socket/socket file - into query(), waitForMessage
function is called, assigning the return into result
variable like the code below:
const wait = waitForMessage(msgId, timeoutMs);
await sendNode(node);
const result = await wait;
When the error does not occur, result
is the message object itself. When the error occurs, result
is the error object like below:
{"tag":"iq","attrs":{"from":"<jid>@g.us","type":"error","id":"<four_digits_number>.<five_digits_number>-<two_digits_number>"},"content":[{"tag":"error","attrs":{"code":"429","text":"rate-overlimit"}}]}
result
is passed as parameter to WABinary_1.assertNodeErrorFree
function that throws a Boom Error when error
is the value of type
key into result.content
I found out where the error is happening, but I didn't find out the cause 😭
add cache and no request every time groupMetadata
Even though not using
groupMetadata
, the issue remains
baileys fetch groupMetadata to send message, even you not fetch, that's why you should use caching, in socket have cachedGroupMetadata
argument
Description
When sending or receiving a bunch of group messages in a short period of time, the following error is triggered:
Reproducibility
Expected behavior
All the messages should be sent/received without triggering errors.
Environment
connectOptions
look like?