From c88ddef2f9a41a1525df70c472fba85755ef4eef Mon Sep 17 00:00:00 2001 From: meowarex Date: Sat, 28 Feb 2026 16:45:21 +1100 Subject: [PATCH] Forgot a Timeout <3 --- plugins/radiant-lyrics-luna/src/index.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/radiant-lyrics-luna/src/index.ts b/plugins/radiant-lyrics-luna/src/index.ts index f366c03..844b1cb 100644 --- a/plugins/radiant-lyrics-luna/src/index.ts +++ b/plugins/radiant-lyrics-luna/src/index.ts @@ -1854,12 +1854,16 @@ const romanizeLinePayload = async ( ]; for (const url of urls) { + const controller = new AbortController(); + const timeout = setTimeout(() => controller.abort(), 5000); try { const res = await fetch(url, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(payload), + signal: controller.signal, }); + clearTimeout(timeout); if (!res.ok) { trace.log(`Romanize: request failed ${res.status} from ${url}`); continue; @@ -1879,7 +1883,12 @@ const romanizeLinePayload = async ( cachedTidalRomanizedLines = romanized; return romanized; } catch (err) { - trace.log(`Romanize: request error from ${url}: ${err}`); + clearTimeout(timeout); + if (err instanceof DOMException && err.name === "AbortError") { + trace.log(`Romanize: request timed out from ${url}`); + } else { + trace.log(`Romanize: request error from ${url}: ${err}`); + } } }