From 194ef5478eb48d870c5d8844f1be6393dcd37ffa Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Fri, 13 Aug 2021 22:57:46 +0200 Subject: :construction: fix server bundle --- util/src/util/Config.ts | 8 ++++---- util/src/util/Event.ts | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'util/src') diff --git a/util/src/util/Config.ts b/util/src/util/Config.ts index a23d724d..09a42564 100644 --- a/util/src/util/Config.ts +++ b/util/src/util/Config.ts @@ -43,11 +43,11 @@ export interface KafkaBroker { export interface DefaultOptions { gateway: { - endpointClientKeepDefault?: boolean; + endpointClient: string | null; endpoint: string | null; }; cdn: { - endpointClientKeepDefault?: boolean; + endpointClient: string | null; endpoint: string | null; }; general: { @@ -150,11 +150,11 @@ export interface DefaultOptions { export const DefaultOptions: DefaultOptions = { gateway: { - endpointClientKeepDefault: false, + endpointClient: null, endpoint: null, }, cdn: { - endpointClientKeepDefault: false, + endpointClient: null, endpoint: null, }, general: { diff --git a/util/src/util/Event.ts b/util/src/util/Event.ts index 13dd797a..c088e8b3 100644 --- a/util/src/util/Event.ts +++ b/util/src/util/Event.ts @@ -16,6 +16,7 @@ export async function emitEvent(payload: Omit) { const successful = RabbitMQ.channel?.publish(id, "", Buffer.from(`${data}`), { type: payload.event }); if (!successful) throw new Error("failed to send event"); } else { + console.log("emit event", id); events.emit(id, payload); } } @@ -44,7 +45,11 @@ export async function listenEvent(event: string, callback: (event: EventOpts) => // @ts-ignore return rabbitListen(opts?.channel || RabbitMQ.channel, event, callback, { acknowledge: opts?.acknowledge }); } else { - const cancel = () => events.removeListener(event, callback); + const cancel = () => { + console.log("cancel event", event); + events.removeListener(event, callback); + }; + console.log("listen event", event); events.addListener(event, (opts) => callback({ ...opts, cancel })); return cancel; -- cgit 1.5.1