diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/src/util/Config.ts | 8 | ||||
-rw-r--r-- | util/src/util/Event.ts | 7 |
2 files changed, 10 insertions, 5 deletions
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<Event, "created_at">) { 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; |