From 0430670a01c2fb209a358facc7182e1d66267615 Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Tue, 2 Jul 2024 22:09:33 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=97=EF=B8=8F=20Added=20structure=20for?= =?UTF-8?q?=20the=20UI=20notification?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/comicprocessor.service.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/services/comicprocessor.service.ts b/services/comicprocessor.service.ts index 28550af..32a188c 100644 --- a/services/comicprocessor.service.ts +++ b/services/comicprocessor.service.ts @@ -136,10 +136,10 @@ export default class ComicProcessorService extends Service { this.logger.error("Error processing job:", error); } }, - produceResultsToKafka: async () => { + produceResultsToKafka: async (query: string) => { try { /* - Kafka messages need to be in a format that can be serialized to JSON, and a Map is not directly serializable in a way that retains its structure, hence we use Object.fromEntries + Kafka messages need to be in a format that can be serialized to JSON, and a Map is not directly serializable in a way that retains its structure, hence why we use Object.fromEntries */ await this.kafkaProducer.send({ topic: "comic-search-results", @@ -159,7 +159,8 @@ export default class ComicProcessorService extends Service { event: "searchResultsAvailable", args: [ { - bokya: Object.fromEntries(this.airDCPPSearchResults), + query, + results: Object.fromEntries(this.airDCPPSearchResults), }, ], }); @@ -259,7 +260,7 @@ export default class ComicProcessorService extends Service { this.logger.info( `Search complete for query: "${data.searchInfo.query.pattern}"`, ); - await this.produceResultsToKafka(); + await this.produceResultsToKafka(data.searchInfo.query.pattern); }); }, async stopped() {