diff --git a/apps/server/src/lane-status.ts b/apps/server/src/lane-status.ts index 82924d4..746ad3e 100644 --- a/apps/server/src/lane-status.ts +++ b/apps/server/src/lane-status.ts @@ -14,11 +14,13 @@ import { directionOf } from "./device-resolve.js"; // flips free after BUSY_TTL_MS. A "both"-direction camera marks BOTH lanes. /** How long after the last vehicle detection a lane stays "busy" before clearing. - * Must exceed the camera's `active` re-fire interval (observed ~30-80s on the test - * unit) so a parked car keeps the lane busy. Override with LANE_BUSY_TTL_MS. */ + * Must exceed the camera's `active` re-fire interval so a still-present car keeps the + * lane busy. Measured on the test unit: while a vehicle is in the zone the camera + * re-fires `active` about every ~1s — so a few seconds of silence reliably means the + * car has left. 5s gives fast clearing without flicker. Override with LANE_BUSY_TTL_MS. */ export function busyTtlMs(): number { - const raw = Number(process.env.LANE_BUSY_TTL_MS ?? 90_000); - return Number.isFinite(raw) && raw > 0 ? raw : 90_000; + const raw = Number(process.env.LANE_BUSY_TTL_MS ?? 5_000); + return Number.isFinite(raw) && raw > 0 ? raw : 5_000; } export class LaneStatus {