From 5e80f5ace30a1ce5d716a4a3c5cc8e83e67f011d Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Mon, 21 Mar 2022 23:29:56 +0530 Subject: [PATCH] chore: ack history before processing --- src/Socket/messages-recv.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Socket/messages-recv.ts b/src/Socket/messages-recv.ts index 0fe003e..6c7ca7d 100644 --- a/src/Socket/messages-recv.ts +++ b/src/Socket/messages-recv.ts @@ -135,7 +135,6 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => { const histNotification = protocolMsg!.historySyncNotification logger.info({ histNotification, id: message.key.id }, 'got history notification') - const { chats, contacts, messages, isLatest } = await downloadAndProcessHistorySyncNotification(histNotification, historyCache) const meJid = authState.creds.me!.id await sendNode({ @@ -147,6 +146,8 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => { } }) + const { chats, contacts, messages, isLatest } = await downloadAndProcessHistorySyncNotification(histNotification, historyCache) + if(chats.length) { ev.emit('chats.set', { chats, isLatest }) }