From 651e3ac7bb800f2ad5d26adf7a0883c0c2f46fe0 Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Mon, 18 Nov 2024 11:07:38 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Added=20an=20undefined=20check?= =?UTF-8?q?=20for=20the=20results?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/comicprocessor.service.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/services/comicprocessor.service.ts b/services/comicprocessor.service.ts index a53fab2..5abf17d 100644 --- a/services/comicprocessor.service.ts +++ b/services/comicprocessor.service.ts @@ -2,7 +2,7 @@ import { Service, ServiceBroker, ServiceSchema } from "moleculer"; import { Kafka, EachMessagePayload, logLevel } from "kafkajs"; import io from "socket.io-client"; -import { isUndefined } from "lodash"; +import { isNil, isUndefined } from "lodash"; import stringSimilarity from "string-similarity-alg"; interface SearchResult { @@ -122,10 +122,10 @@ export default class ComicProcessorService extends Service { await this.broker.call("socket.search", { query: dcppSearchQuery, config: { - hostname: "localhost:5600", + hostname: "192.168.1.119:5600", protocol: "http", - username: "user", - password: "pass", + username: "admin", + password: "password", }, namespace: "/automated", }); @@ -257,7 +257,9 @@ export default class ComicProcessorService extends Service { if (!this.airDCPPSearchResults.has(instanceId)) { this.airDCPPSearchResults.set(instanceId, []); } - this.airDCPPSearchResults.get(instanceId).push(groupedResult.result); + if (!isUndefined(groupedResult?.result)) { + this.airDCPPSearchResults.get(instanceId).push(groupedResult.result); + } }, );