From 4c3f2ea0b0b3faf6d514cc517169df24cd4a6d11 Mon Sep 17 00:00:00 2001 From: Gus Narea Date: Fri, 2 Jul 2021 17:30:40 +0100 Subject: [PATCH] fix: Work around https://github.com/relaycorp/awala-gateway-desktop/issues/365 --- packages/daemon/src/server/poweb/parcelCollection.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/daemon/src/server/poweb/parcelCollection.ts b/packages/daemon/src/server/poweb/parcelCollection.ts index 73e6a4602..9bd12f346 100644 --- a/packages/daemon/src/server/poweb/parcelCollection.ts +++ b/packages/daemon/src/server/poweb/parcelCollection.ts @@ -139,6 +139,13 @@ function makeDeliveryStream( ): (parcelKeys: AsyncIterable) => AsyncIterable { return async function* (parcelKeys): AsyncIterable { for await (const parcelKey of parcelKeys) { + // TODO: Undo this. See https://github.com/relaycorp/awala-gateway-desktop/issues/365. + // istanbul ignore next + if (socket.readyState !== socket.OPEN) { + // istanbul ignore next + break; + } + const parcelSerialized = await parcelStore.retrieve( parcelKey, MessageDirection.FROM_INTERNET,