diff --git a/packages/core/src/bus/index.ts b/packages/core/src/bus/index.ts index b40fb41d..9d336536 100644 --- a/packages/core/src/bus/index.ts +++ b/packages/core/src/bus/index.ts @@ -35,27 +35,6 @@ export namespace Bus { subClient.connect().catch(() => Promise.resolve()), ]); - // global dispatcher for incoming messages - subClient.subscribe("message", (channel: string, message: string) => { - const handlers = subscribers.get(channel); - if (!handlers?.length) return; - try { - const parsed = JSON.parse(message); - for (const h of handlers) { - // call handlers without awaiting so one slow handler doesn't block the dispatcher - try { - const r = h(parsed.detail, parsed) as any; - if (r instanceof Promise) - r.catch((e) => log.error("bus handler error", e)); - } catch (e: any) { - log.error("bus handler error", e); - } - } - } catch (e: any) { - log.error("bus: failed to parse message", e); - } - }); - return { pubClient, subClient }; } catch (err: any) { log.error("bus: failed to connect to redis", err);