resync from scratch if current sync fails

This commit is contained in:
Adhiraj Singh
2021-10-08 10:48:22 +05:30
parent c5d8389754
commit edc10d0923

View File

@@ -352,8 +352,13 @@ export const makeChatsSocket = (config: SocketConfig) => {
const appPatch = async(patchCreate: WAPatchCreate) => {
const name = patchCreate.type
await resyncState(name, false)
try {
await resyncState(name, false)
} catch(error) {
logger.info({ name, error: error.stack }, 'failed to sync state from version, trying from scratch')
await resyncState(name, true)
}
const { patch, state } = await encodeSyncdPatch(
patchCreate,
authState,