From 7e800b090d335ec5ead01f2819f6f175f5b5addb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Iv=C3=A1n=20Vieitez=20Parra?= <3857362+corrideat@users.noreply.github.com> Date: Tue, 6 Aug 2024 15:13:59 +0000 Subject: [PATCH] Enqueue all pubsub events --- shared/domains/chelonia/chelonia.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/shared/domains/chelonia/chelonia.js b/shared/domains/chelonia/chelonia.js index 82e60096d..4dd2e2c1b 100644 --- a/shared/domains/chelonia/chelonia.js +++ b/shared/domains/chelonia/chelonia.js @@ -573,14 +573,14 @@ export default (sbp('sbp/selectors/register', { console.info(`[chelonia] Discarding pub event for ${msg.channelID} because it's not in the current subscriptionSet`) return } - try { + sbp('chelonia/queueInvocation', msg.channelID, () => { (v: Function)(parseEncryptedOrUnencryptedMessage.call(this, { contractID: msg.channelID, serializedData: msg.data })) - } catch (e) { + }).catch(e => { console.error(`[chelonia] Error processing pub event for ${msg.channelID}`, e) - } + }) }] case NOTIFICATION_TYPE.KV: return [k, (msg) => { @@ -592,15 +592,15 @@ export default (sbp('sbp/selectors/register', { console.info(`[chelonia] Discarding kv event for ${msg.channelID} because it's not in the current subscriptionSet`) return } - try { + sbp('chelonia/queueInvocation', msg.channelID, () => { (v: Function)([msg.key, parseEncryptedOrUnencryptedMessage.call(this, { contractID: msg.channelID, meta: msg.key, serializedData: JSON.parse(Buffer.from(msg.data).toString()) })]) - } catch (e) { + }).catch(e => { console.error(`[chelonia] Error processing kv event for ${msg.channelID} and key ${msg.key}`, e) - } + }) }] default: return [k, v]