From 265748c29935d0e7a2ae69c98bc130145f123cf4 Mon Sep 17 00:00:00 2001 From: Steffen Meyer Date: Thu, 18 Jan 2024 22:29:46 +0100 Subject: [PATCH] fix: small memory leak --- packages/core/src/actor/dispatch.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/src/actor/dispatch.ts b/packages/core/src/actor/dispatch.ts index e9168fd..3866515 100644 --- a/packages/core/src/actor/dispatch.ts +++ b/packages/core/src/actor/dispatch.ts @@ -14,10 +14,11 @@ export async function dispatch>; if (waitTillResponse) { returnValue = new Promise((resolve) => { - actor.onMessage((msgs) => { + const unsub = actor.onMessage((msgs) => { // TODO: just a workaround const msg = msgs[0] as unknown as Message; resolve(msg); + unsub(); }); }); }