Files
parking_solution/apps
julian 73ada89a13
Build & push images / images (push) Successful in 3m45s
fix(server): bound active-sessions cost, index hot paths, no phantom relay timeouts
park-2 (2026-10-24): GET /api/sessions/active ran ~2 s synchronously — PayStation.activeSessions
called quote() per open unpaid transient (664 rows), each 3-4 unindexed ledger_events scans by
identity — 2234x/day. The frozen event loop made the Dingtian driver's 2 s timer fire before the
already-received UDP reply (timers run before poll I/O), so healthy pulses logged "timeout"; the
subscription flow then unwound before firing the camera or writing the sessions row, leaving
signed entries with no snapshot. Cost grew ~120 ms/day with the operator's open-ticket count.

- pay-station: price every list row from the one ledger scan (rows grouped per identity ->
  #quoteFromRows); tariff resolver built once per request; quote(identity) wraps the same core.
  validations: sessionValidationsFromRows / liveValidationsFromRows. Test pins list == quote().
- db 0032_hot_path_indexes: ledger_events(identity,index), device_events(category,kind,
  occurred_at), device_events(kind,occurred_at), snapshots(identity), sessions(state),
  sessions(subscription_id,state). Additive.
- access-dingtian binaryUdp: defer the timeout rejection with setImmediate so a datagram that
  already arrived wins over an expired timer.
- subscription-flow: snapshot fired and session cache written/closed BEFORE the pulse.

wiki/concepts/park-2-event-loop-stall.md has the full analysis.
2026-10-24 11:17:30 +02:00
..