Await cache checks for message resend logic (#2136)
This commit is contained in:
@@ -142,7 +142,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
throw new Boom('Not authenticated')
|
throw new Boom('Not authenticated')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (placeholderResendCache.get(messageKey?.id!)) {
|
if (await placeholderResendCache.get(messageKey?.id!)) {
|
||||||
logger.debug({ messageKey }, 'already requested resend')
|
logger.debug({ messageKey }, 'already requested resend')
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
@@ -151,7 +151,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
|
|
||||||
await delay(5000)
|
await delay(5000)
|
||||||
|
|
||||||
if (!placeholderResendCache.get(messageKey?.id!)) {
|
if (!await placeholderResendCache.get(messageKey?.id!)) {
|
||||||
logger.debug({ messageKey }, 'message received while resend requested')
|
logger.debug({ messageKey }, 'message received while resend requested')
|
||||||
return 'RESOLVED'
|
return 'RESOLVED'
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
if (placeholderResendCache.get(messageKey?.id!)) {
|
if (await placeholderResendCache.get(messageKey?.id!)) {
|
||||||
logger.debug({ messageKey }, 'PDO message without response after 15 seconds. Phone possibly offline')
|
logger.debug({ messageKey }, 'PDO message without response after 15 seconds. Phone possibly offline')
|
||||||
await placeholderResendCache.del(messageKey?.id!)
|
await placeholderResendCache.del(messageKey?.id!)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user