feat: add bulk "process" capability to BaileysBufferableEventEmitter

This commit is contained in:
Adhiraj Singh
2022-07-04 11:34:41 +05:30
parent de95694266
commit 5cc58d4aed
7 changed files with 190 additions and 128 deletions

View File

@@ -20,7 +20,6 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
ev,
authState,
ws,
mutationMutex,
processingMutex,
upsertMessage,
resyncAppState,
@@ -249,7 +248,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
const update = getBinaryNodeChild(node, 'collection')
if(update) {
const name = update.attrs.name as WAPatchName
await mutationMutex.mutex(() => resyncAppState([name], undefined))
await resyncAppState([name], undefined)
}
}
@@ -591,10 +590,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
}
const protoMsg = proto.WebMessageInfo.fromObject(msg)
ev.emit(
'messages.upsert',
{ messages: [protoMsg], type: call.offline ? 'append' : 'notify' }
)
upsertMessage(protoMsg, call.offline ? 'append' : 'notify')
}
})