diff --git a/cmd/hwlab-edge-proxy/main.test.ts b/cmd/hwlab-edge-proxy/main.test.ts index e8fbe4c1..eb75192b 100644 --- a/cmd/hwlab-edge-proxy/main.test.ts +++ b/cmd/hwlab-edge-proxy/main.test.ts @@ -14,6 +14,7 @@ test("edge proxy reports local health and proxies live health to upstream", asyn assert.equal(health.status, "ok"); assert.equal(health.service.role, "public-dev-ingress"); assert.equal(health.details.upstream, `http://127.0.0.1:${upstream.port}`); + assert.equal(health.details.idleTimeoutSeconds, 120); assert.equal(health.details.mode, "dev-edge-proxy"); const routes = await fetchJson(`http://127.0.0.1:${proxy.port}/routes`); diff --git a/cmd/hwlab-edge-proxy/main.ts b/cmd/hwlab-edge-proxy/main.ts index 1285333a..5c0e044a 100644 --- a/cmd/hwlab-edge-proxy/main.ts +++ b/cmd/hwlab-edge-proxy/main.ts @@ -10,6 +10,10 @@ const proxyTimeoutMs = parseTimeout(process.env.HWLAB_EDGE_PROXY_TIMEOUT_MS, 126 min: 1000, max: 2400000 }); +const idleTimeoutSeconds = parseTimeout(process.env.HWLAB_EDGE_IDLE_TIMEOUT_SECONDS, 120, { + min: 1, + max: 255 +}); const { host, port } = resolveHostPort({ listenEnv: "HWLAB_EDGE_LISTEN", hostEnv: "HWLAB_EDGE_HOST", @@ -21,6 +25,7 @@ function proxyDetails() { return { upstream, timeoutMs: proxyTimeoutMs, + idleTimeoutSeconds, mode: "dev-edge-proxy" }; } @@ -34,6 +39,7 @@ function parseTimeout(value, fallback, { min, max }) { const server = Bun.serve({ hostname: host, port, + idleTimeout: idleTimeoutSeconds, async fetch(request, bunServer) { const url = new URL(request.url); diff --git a/deploy/deploy.yaml b/deploy/deploy.yaml index 4f19f5ef..c716a451 100644 --- a/deploy/deploy.yaml +++ b/deploy/deploy.yaml @@ -494,6 +494,7 @@ services: HWLAB_EDGE_LISTEN: 0.0.0.0:6667 HWLAB_EDGE_UPSTREAM: http://hwlab-cloud-api.hwlab-dev.svc.cluster.local:6667 HWLAB_EDGE_PROXY_TIMEOUT_MS: "1260000" + HWLAB_EDGE_IDLE_TIMEOUT_SECONDS: "120" - serviceId: hwlab-agent-skills namespace: hwlab-dev healthPath: /health/live