hotfix: always send acks even in case of errors (#1043)

This commit is contained in:
vini
2024-09-22 08:35:50 -03:00
committed by GitHub
parent fda2689169
commit 71082bf1b3

View File

@@ -622,6 +622,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
ids.push(...items.map(i => i.attrs.id)) ids.push(...items.map(i => i.attrs.id))
} }
try {
await Promise.all([ await Promise.all([
processingMutex.mutex( processingMutex.mutex(
async() => { async() => {
@@ -680,9 +681,11 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
} }
} }
} }
), )
sendMessageAck(node)
]) ])
} finally {
await sendMessageAck(node)
}
} }
const handleNotification = async(node: BinaryNode) => { const handleNotification = async(node: BinaryNode) => {
@@ -693,6 +696,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
return return
} }
try {
await Promise.all([ await Promise.all([
processingMutex.mutex( processingMutex.mutex(
async() => { async() => {
@@ -713,9 +717,11 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
await upsertMessage(fullMsg, 'append') await upsertMessage(fullMsg, 'append')
} }
} }
), )
sendMessageAck(node)
]) ])
} finally {
await sendMessageAck(node)
}
} }
const handleMessage = async(node: BinaryNode) => { const handleMessage = async(node: BinaryNode) => {
@@ -761,6 +767,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
} }
} }
try {
await Promise.all([ await Promise.all([
processingMutex.mutex( processingMutex.mutex(
async() => { async() => {
@@ -814,9 +821,11 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
await upsertMessage(msg, node.attrs.offline ? 'append' : 'notify') await upsertMessage(msg, node.attrs.offline ? 'append' : 'notify')
} }
), )
sendMessageAck(node)
]) ])
} finally {
await sendMessageAck(node)
}
} }
const fetchMessageHistory = async( const fetchMessageHistory = async(