From 369b1d19a4fe041de9ff1927810494acda08778f Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 5 Apr 2023 03:51:04 -0400 Subject: [PATCH] *remove the current listeners sync function from the syncProtomux before emitting to not create an infinite loop, and add back after --- src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/index.ts b/src/index.ts index eacb615..2769296 100644 --- a/src/index.ts +++ b/src/index.ts @@ -455,7 +455,9 @@ async function handleSyncProtomux(aq: ActiveQuery) { } }); mux._free = mux._free.filter((item: any) => item !== undefined); + socket.off("syncProtomux", sync); socket.emit("syncProtomux"); + socket.on("syncProtomux", sync); mutex.release(); });