fix: remove health check remove (#371)

This commit is contained in:
Nikhil
2026-02-26 19:22:18 -08:00
committed by GitHub
parent f9fb2f8a02
commit 96797ed101
2 changed files with 1 additions and 21 deletions

View File

@@ -4,35 +4,15 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { EXIT_CODES } from '@browseros/shared/constants/exit-codes'
import { Hono } from 'hono'
import type { Browser } from '../../browser/browser'
import { logger } from '../../lib/logger'
const HEALTH_CHECK_TIMEOUT = 5 * 60 * 1000 // 5 minutes
interface HealthDeps {
browser?: Browser
}
export function createHealthRoute(deps: HealthDeps = {}) {
let watchdogTimer: ReturnType<typeof setTimeout> | null = null
function resetWatchdog() {
if (watchdogTimer) clearTimeout(watchdogTimer)
watchdogTimer = setTimeout(() => {
logger.error(
'No health check received in 5 minutes, Chromium may be gone — exiting',
)
process.exit(EXIT_CODES.GENERAL_ERROR)
}, HEALTH_CHECK_TIMEOUT)
}
// Start the watchdog on creation
resetWatchdog()
return new Hono().get('/', (c) => {
resetWatchdog()
const cdpConnected = deps.browser?.isCdpConnected() ?? true
return c.json({ status: 'ok', cdpConnected })
})

View File

@@ -139,7 +139,7 @@
},
"apps/server": {
"name": "@browseros/server",
"version": "0.0.60",
"version": "0.0.61",
"bin": {
"browseros-server": "./src/index.ts",
},