mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
perf: single process event for processSyncActions
This commit is contained in:
@@ -228,12 +228,13 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
||||
if(newMutations.length) {
|
||||
logger.trace({ newMutations, name }, 'recv new mutations')
|
||||
}
|
||||
processSyncActions(newMutations)
|
||||
|
||||
totalMutations.push(...newMutations)
|
||||
}
|
||||
}
|
||||
|
||||
processSyncActions(totalMutations)
|
||||
|
||||
return totalMutations
|
||||
}
|
||||
|
||||
@@ -419,9 +420,7 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
||||
initial,
|
||||
authState.keys,
|
||||
)
|
||||
// temp: verify it was encoded correctly
|
||||
const result = await decodePatches(name, [{ ...patch, version: { version: state.version }, }], initial, authState.keys.getAppStateSyncKey)
|
||||
|
||||
|
||||
const node: BinaryNode = {
|
||||
tag: 'iq',
|
||||
attrs: {
|
||||
@@ -458,6 +457,7 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
||||
await authState.keys.setAppStateSyncVersion(name, state)
|
||||
|
||||
if(config.emitOwnEvents) {
|
||||
const result = await decodePatches(name, [{ ...patch, version: { version: state.version }, }], initial, authState.keys.getAppStateSyncKey)
|
||||
processSyncActions(result.newMutations)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user