From 96093d515e0e5e789db3a0e95fdc90376b958bce Mon Sep 17 00:00:00 2001 From: Natty Date: Thu, 19 Dec 2024 20:16:05 +0100 Subject: [PATCH] Fix delivery handling --- packages/backend/src/mag/rpc-client.ts | 1 + packages/backend/src/queue/processors/deliver.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/packages/backend/src/mag/rpc-client.ts b/packages/backend/src/mag/rpc-client.ts index 53dc0bcc32..4e772fc01e 100644 --- a/packages/backend/src/mag/rpc-client.ts +++ b/packages/backend/src/mag/rpc-client.ts @@ -132,6 +132,7 @@ async function rpcCall(method: string, data: D): Promise { const timeout = setTimeout(() => { client.off("close", clearAndReject); client.off("error", clearAndReject); + client.removeAllListeners(`mag-data:${currentSerial}`); reject(new Error("Promise timeout")) }, 60000); diff --git a/packages/backend/src/queue/processors/deliver.ts b/packages/backend/src/queue/processors/deliver.ts index 74036c6d2c..c5de8e21ab 100644 --- a/packages/backend/src/queue/processors/deliver.ts +++ b/packages/backend/src/queue/processors/deliver.ts @@ -24,6 +24,8 @@ export default async (job: Bull.Job) => { const puny = toPuny(host); + // Drop old deliveries + if (typeof job.data.content !== "string") return "skip"; if (await shouldSkipInstance(puny)) return "skip"; try {