From 4ff858ab82090ca5878442c39a7ffe39c4cc2957 Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Fri, 24 Jun 2022 11:53:01 +0530 Subject: [PATCH] chore: increase app state sync timeout --- src/Socket/messages-recv.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Socket/messages-recv.ts b/src/Socket/messages-recv.ts index afc366a..ce82a59 100644 --- a/src/Socket/messages-recv.ts +++ b/src/Socket/messages-recv.ts @@ -9,6 +9,8 @@ import { areJidsSameUser, BinaryNode, BinaryNodeAttributes, getAllBinaryNodeChil import { makeChatsSocket } from './chats' import { extractGroupMetadata } from './groups' +const APP_STATE_SYNC_TIMEOUT_MS = 10_000 + export const makeMessagesRecvSocket = (config: SocketConfig) => { const { logger, @@ -38,11 +40,12 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => { /** this mutex ensures that each retryRequest will wait for the previous one to finish */ const retryMutex = makeMutex() + /** cache to ensure new history sync events do not have duplicate items */ const historyCache = new Set() let recvChats: InitialReceivedChatsState = { } const appStateSyncTimeout = debouncedTimeout( - 6_000, + APP_STATE_SYNC_TIMEOUT_MS, async() => { logger.info( { recvChats: Object.keys(recvChats).length },