🏗️ Added structure for the UI notification

This commit is contained in:
2024-07-02 22:09:33 -04:00
parent ecdc3845cb
commit 0430670a01

View File

@@ -136,10 +136,10 @@ export default class ComicProcessorService extends Service {
this.logger.error("Error processing job:", error); this.logger.error("Error processing job:", error);
} }
}, },
produceResultsToKafka: async () => { produceResultsToKafka: async (query: string) => {
try { 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({ await this.kafkaProducer.send({
topic: "comic-search-results", topic: "comic-search-results",
@@ -159,7 +159,8 @@ export default class ComicProcessorService extends Service {
event: "searchResultsAvailable", event: "searchResultsAvailable",
args: [ 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( this.logger.info(
`Search complete for query: "${data.searchInfo.query.pattern}"`, `Search complete for query: "${data.searchInfo.query.pattern}"`,
); );
await this.produceResultsToKafka(); await this.produceResultsToKafka(data.searchInfo.query.pattern);
}); });
}, },
async stopped() { async stopped() {