Fix: retry cache is not storing (#863)

* Update messages-recv.ts

* Update messages-recv.ts
This commit is contained in:
Bob
2024-07-03 04:32:48 -03:00
committed by GitHub
parent dbf25771a1
commit c576e9215c

View File

@@ -133,17 +133,18 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
} }
const sendRetryRequest = async(node: BinaryNode, forceIncludeKeys = false) => { const sendRetryRequest = async(node: BinaryNode, forceIncludeKeys = false) => {
const msgId = node.attrs.id const { id: msgId, participant } = node.attrs
let retryCount = msgRetryCache.get<number>(msgId) || 0 const key = `${msgId}:${participant}`
let retryCount = msgRetryCache.get<number>(key) || 0
if(retryCount >= maxMsgRetryCount) { if(retryCount >= maxMsgRetryCount) {
logger.debug({ retryCount, msgId }, 'reached retry limit, clearing') logger.debug({ retryCount, msgId }, 'reached retry limit, clearing')
msgRetryCache.del(msgId) msgRetryCache.del(key)
return return
} }
retryCount += 1 retryCount += 1
msgRetryCache.set(msgId, retryCount) msgRetryCache.set(key, retryCount)
const { account, signedPreKey, signedIdentityKey: identityKey } = authState.creds const { account, signedPreKey, signedIdentityKey: identityKey } = authState.creds