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) {
|
if(newMutations.length) {
|
||||||
logger.trace({ newMutations, name }, 'recv new mutations')
|
logger.trace({ newMutations, name }, 'recv new mutations')
|
||||||
}
|
}
|
||||||
processSyncActions(newMutations)
|
|
||||||
|
|
||||||
totalMutations.push(...newMutations)
|
totalMutations.push(...newMutations)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
processSyncActions(totalMutations)
|
||||||
|
|
||||||
return totalMutations
|
return totalMutations
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,9 +420,7 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
initial,
|
initial,
|
||||||
authState.keys,
|
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 = {
|
const node: BinaryNode = {
|
||||||
tag: 'iq',
|
tag: 'iq',
|
||||||
attrs: {
|
attrs: {
|
||||||
@@ -458,6 +457,7 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
await authState.keys.setAppStateSyncVersion(name, state)
|
await authState.keys.setAppStateSyncVersion(name, state)
|
||||||
|
|
||||||
if(config.emitOwnEvents) {
|
if(config.emitOwnEvents) {
|
||||||
|
const result = await decodePatches(name, [{ ...patch, version: { version: state.version }, }], initial, authState.keys.getAppStateSyncKey)
|
||||||
processSyncActions(result.newMutations)
|
processSyncActions(result.newMutations)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user