WhiskeySockets / Baileys

Lightweight full-featured typescript/javascript WhatsApp Web API

Home Page:https://baileys.whiskeysockets.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] retry function is running indefinitely without control

erickythierry opened this issue · comments

I noticed that the getMessage function passed to the socket is being called indefinitely even though the message id does not exist in the cache to be resent. this occurs even if the maxMsgRetryCount and msgRetryCounterCache properties are set.
I noticed this when analyzing nodeCache msgRetryCounterCache. it is not being populated with resend attempts. so it never reaches the limit of attempts and keeps trying indefinitely.

I'm using version 6.7.4

Below is the socket configuration I use:

const wa = makeWASocket({
            auth: {
                creds: state.creds,
                keys: makeCacheableSignalKeyStore(state.keys, logger),
            },
            printQRInTerminal: true,
            generateHighQualityLinkPreview: true,
            logger,
            version: version,
            markOnlineOnConnect: false,
            msgRetryCounterCache,
            maxMsgRetryCount: 5,
            emitOwnEvents: false,
            syncFullHistory: false,
            shouldIgnoreJid: (jid: string) => isJidBroadcast(jid) || jid.includes("@newsletter"),
            getMessage: async (key) => await msgCache.get(key),
        })

image
an example of what happens. Even populating msgRetryCounterCache correctly, the code keeps trying indefinitely

const msgRetryCounterCache = new NodeCache();

is your cache in the global scope?

const msgRetryCounterCache = new NodeCache();

is your cache in the global scope?

yes