From 7b7d2ac0b3fa55062ab015d376e27056ded62d93 Mon Sep 17 00:00:00 2001 From: Anthony Merlo Date: Sat, 22 Aug 2026 23:21:47 +0100 Subject: [PATCH] v9: minimal test with timeout + IP fallback + catch --- scripts/health-sync.tsx | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/scripts/health-sync.tsx b/scripts/health-sync.tsx index 21f04d5..e45fefc 100644 --- a/scripts/health-sync.tsx +++ b/scripts/health-sync.tsx @@ -1,24 +1,39 @@ // @ts-nocheck -// Health Sync v8 — minimal test version +// Health Sync v9 — minimal test with timeout + IP fallback import { Script } from "scripting" // icon-color: deep-blue; icon-glyph: heart; async function main() { - console.log("v8: script started") + console.log("v9: script started") - try { - const response = await fetch("http://chronos:9432/health", { - allowInsecureRequest: true - }) - const text = await response.text() - console.log("v8: health check = " + text) - } catch (e) { - console.log("v8: fetch error = " + e) + // Try hostname first, then LAN IP + const urls = [ + "http://chronos:9432/health", + "http://192.168.1.148:9432/health", + "http://100.120.136.16:9432/health" + ] + + for (const url of urls) { + console.log("v9: trying " + url) + try { + const response = await fetch(url, { + allowInsecureRequest: true, + timeout: 5 + }) + const text = await response.text() + console.log("v9: SUCCESS from " + url + " = " + text) + break + } catch (e) { + console.log("v9: FAILED " + url + " = " + e) + } } - console.log("v8: done") + console.log("v9: done") } -main().then(() => Script.exit()) \ No newline at end of file +main().then(() => Script.exit()).catch((e) => { + console.log("v9: main() error = " + e) + Script.exit() +}) \ No newline at end of file