From 49f8e7b2c45066017d24b0e2bf3779a442647f39 Mon Sep 17 00:00:00 2001 From: Moe Jangda Date: Wed, 7 Jun 2023 05:52:18 -0700 Subject: [PATCH] ignore non-existent message --- packages/web5-user-agent/src/sync-api.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/web5-user-agent/src/sync-api.ts b/packages/web5-user-agent/src/sync-api.ts index 257e138d4..c64c68444 100644 --- a/packages/web5-user-agent/src/sync-api.ts +++ b/packages/web5-user-agent/src/sync-api.ts @@ -291,7 +291,16 @@ export class SyncApi implements SyncManager { } for (let entry of reply.messages) { - // TODO: check entry.error + if (entry.error || !entry.message) { + console.warn(`message ${messageCid} not found. entry: ${JSON.stringify(entry, null, 2)} ignoring..`); + + await this.setWatermark(did, dwnUrl, 'pull', watermark); + await this.#addMessage(did, messageCid); + delOps.push({ type: 'del', key }); + + continue; + } + const messageType = this.#getDwnMessageType(entry.message); let dataStream;