v9: minimal test with timeout + IP fallback + catch

This commit is contained in:
Anthony Merlo 2026-08-22 23:21:47 +01:00
parent 1b84eb8c60
commit 7b7d2ac0b3

View file

@ -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 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("http://chronos:9432/health", {
allowInsecureRequest: true
const response = await fetch(url, {
allowInsecureRequest: true,
timeout: 5
})
const text = await response.text()
console.log("v8: health check = " + text)
console.log("v9: SUCCESS from " + url + " = " + text)
break
} catch (e) {
console.log("v8: fetch error = " + e)
console.log("v9: FAILED " + url + " = " + e)
}
}
console.log("v8: done")
console.log("v9: done")
}
main().then(() => Script.exit())
main().then(() => Script.exit()).catch((e) => {
console.log("v9: main() error = " + e)
Script.exit()
})