mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: add history msg to creds.update to prevent race condition
This commit is contained in:
@@ -125,19 +125,19 @@ const processMessage = async(
|
|||||||
}, 'got history notification')
|
}, 'got history notification')
|
||||||
|
|
||||||
if(process) {
|
if(process) {
|
||||||
const data = await downloadAndProcessHistorySyncNotification(
|
|
||||||
histNotification,
|
|
||||||
options
|
|
||||||
)
|
|
||||||
|
|
||||||
ev.emit('messaging-history.set', { ...data, isLatest })
|
|
||||||
|
|
||||||
ev.emit('creds.update', {
|
ev.emit('creds.update', {
|
||||||
processedHistoryMessages: [
|
processedHistoryMessages: [
|
||||||
...(creds.processedHistoryMessages || []),
|
...(creds.processedHistoryMessages || []),
|
||||||
{ key: message.key, messageTimestamp: message.messageTimestamp }
|
{ key: message.key, messageTimestamp: message.messageTimestamp }
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const data = await downloadAndProcessHistorySyncNotification(
|
||||||
|
histNotification,
|
||||||
|
options
|
||||||
|
)
|
||||||
|
|
||||||
|
ev.emit('messaging-history.set', { ...data, isLatest })
|
||||||
}
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
@@ -152,8 +152,6 @@ const processMessage = async(
|
|||||||
const strKeyId = Buffer.from(keyId!.keyId!).toString('base64')
|
const strKeyId = Buffer.from(keyId!.keyId!).toString('base64')
|
||||||
newKeys.push(strKeyId)
|
newKeys.push(strKeyId)
|
||||||
|
|
||||||
logger?.trace({ strKeyId }, 'got app state sync key')
|
|
||||||
|
|
||||||
await keyStore.set({ 'app-state-sync-key': { [strKeyId]: keyData! } })
|
await keyStore.set({ 'app-state-sync-key': { [strKeyId]: keyData! } })
|
||||||
|
|
||||||
newAppStateSyncKeyId = strKeyId
|
newAppStateSyncKeyId = strKeyId
|
||||||
|
|||||||
Reference in New Issue
Block a user