mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-07-18 13:40:22 +00:00
d5ccaf0c27
Codex CORE findings on the fingerprint: (1) default busy timeout could stall /api/sessions ~10s on a locked state.db; (2) COUNT(*) forced a full messages table SCAN (~16-22ms/refresh on 200k rows). Fix: open file:...?mode=ro with timeout=0.05 + PRAGMA busy_timeout=50 (returns fast, falls back to stat stamp on lock), and use index-only MAX(rowid) per table (no COUNT, no scan). Verified: EXPLAIN shows SEARCH not SCAN, 0.36ms on 200k msgs, 0.16ms while EXCLUSIVE-locked. Fingerprint shape is now (sessions_max_rowid, messages_max_rowid); regression tests updated.