Fix health check treating 404 as unreachable
Apps without a /health route return 404 from nginx, but the service IS running. Treat any HTTP response as up; only connection errors are down. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
5b3b45a45c
commit
dae5524dbc
1 changed files with 2 additions and 2 deletions
|
|
@ -111,10 +111,10 @@ app.get('/health-status', async () => {
|
||||||
Object.entries(healthMap).map(async ([name, { host, port }]) => {
|
Object.entries(healthMap).map(async ([name, { host, port }]) => {
|
||||||
const t0 = Date.now()
|
const t0 = Date.now()
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`http://${host}:${port}/health`, {
|
await fetch(`http://${host}:${port}/health`, {
|
||||||
signal: AbortSignal.timeout(3000),
|
signal: AbortSignal.timeout(3000),
|
||||||
})
|
})
|
||||||
return { name, up: res.ok, ms: Date.now() - t0 }
|
return { name, up: true, ms: Date.now() - t0 }
|
||||||
} catch {
|
} catch {
|
||||||
return { name, up: false, ms: null }
|
return { name, up: false, ms: null }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue