From ca50338be1fceb4944c4f38191e2aa2b035bd46b Mon Sep 17 00:00:00 2001 From: Rajeh Taher Date: Sat, 18 Oct 2025 20:28:03 +0300 Subject: [PATCH] signal: process devices sequentially --- src/Utils/signal.ts | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/Utils/signal.ts b/src/Utils/signal.ts index 53638cae..589ca810 100644 --- a/src/Utils/signal.ts +++ b/src/Utils/signal.ts @@ -109,26 +109,24 @@ export const parseAndInjectE2ESessions = async (node: BinaryNode, repository: Si const chunks = chunk(nodes, chunkSize) for (const nodesChunk of chunks) { - await Promise.all( - nodesChunk.map(async (node: BinaryNode) => { - const signedKey = getBinaryNodeChild(node, 'skey')! - const key = getBinaryNodeChild(node, 'key')! - const identity = getBinaryNodeChildBuffer(node, 'identity')! - const jid = node.attrs.jid! + for (const node of nodesChunk) { + const signedKey = getBinaryNodeChild(node, 'skey')! + const key = getBinaryNodeChild(node, 'key')! + const identity = getBinaryNodeChildBuffer(node, 'identity')! + const jid = node.attrs.jid! - const registrationId = getBinaryNodeChildUInt(node, 'registration', 4) + const registrationId = getBinaryNodeChildUInt(node, 'registration', 4) - await repository.injectE2ESession({ - jid, - session: { - registrationId: registrationId!, - identityKey: generateSignalPubKey(identity), - signedPreKey: extractKey(signedKey)!, - preKey: extractKey(key)! - } - }) + await repository.injectE2ESession({ + jid, + session: { + registrationId: registrationId!, + identityKey: generateSignalPubKey(identity), + signedPreKey: extractKey(signedKey)!, + preKey: extractKey(key)! + } }) - ) + } } }