From d32b4a2cb2d0b4454adefcba3621bf0123a69617 Mon Sep 17 00:00:00 2001 From: "nise.moe" Date: Thu, 15 Feb 2024 20:39:48 +0100 Subject: [PATCH] Handle possible errors in konata comparation results --- .../com/nisemoe/nise/scheduler/ImportScores.kt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/nise-backend/src/main/kotlin/com/nisemoe/nise/scheduler/ImportScores.kt b/nise-backend/src/main/kotlin/com/nisemoe/nise/scheduler/ImportScores.kt index d6227dc..c86b930 100644 --- a/nise-backend/src/main/kotlin/com/nisemoe/nise/scheduler/ImportScores.kt +++ b/nise-backend/src/main/kotlin/com/nisemoe/nise/scheduler/ImportScores.kt @@ -393,12 +393,19 @@ class ImportScores( .fetchInto(ReplayDto::class.java) sw.start("konata") - val replaysForKonata = allReplays.map { - Replay(string = it.replayData, id = it.replayId, mods = it.replayMods) - }.toTypedArray() - val konataResults: List = compareReplaySet(replaysForKonata) - sw.stop() + val konataResults: List = try { + val replaysForKonata = allReplays.map { + Replay(string = it.replayData, id = it.replayId, mods = it.replayMods) + }.toTypedArray() + compareReplaySet(replaysForKonata) + } catch (e: Exception) { + this.logger.error("Failed to process similarity with Konata for beatmapId = $beatmapId.") + this.logger.error(e.stackTraceToString()) + return + } finally { + sw.stop() + } this.logger.info("Obtained result from Konata in ${sw.lastTaskInfo().timeSeconds}s for ${allReplays.size} replays.") this.logger.info("Pairs/s = ${konataResults.size / sw.lastTaskInfo().timeSeconds}")