Commit Graph

11 Commits

Author SHA1 Message Date
bot 1ca2dc21f5 Add BLE layer: firmware, coordinator support, dashboard tab 2026-04-27 14:21:02 +03:00
bot 9fd97e6925 Fix recurring WAL corruption with RESTART checkpointing
Root cause: SQLite's default PASSIVE checkpoint mode cannot complete
under sustained write load (4 nodes, hundreds of events/min) because
active readers always block it. The WAL grows unbounded and eventually
corrupts the main DB file.

- Add dedicated checkpoint_wal() using PRAGMA wal_checkpoint(RESTART),
  which waits for readers to finish then checkpoints fully and resets
  the WAL back to the start.
- Add background checkpointer task running every 30 minutes, separate
  from the 6-hour prune cycle.
- Remove PASSIVE checkpoint from prune_old_events(), replace with call
  to checkpoint_wal() after pruning completes.
- Set wal_autocheckpoint=500 on every connection (~2MB threshold) so
  SQLite's own auto-checkpoint also triggers more frequently.
- Reduce HOT_DAYS from 30 to 7: at current data rate (~500k beacons/day)
  30-day retention would grow to several GB before first prune runs.
  7 days keeps the DB under ~200MB and queries fast permanently.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 08:34:52 +03:00
bot 7f702133cc Fix SSE reconnect storm and document node dropout findings
- Fix stale EventSource accumulation: onerror handler now closes the
  existing EventSource before creating a new one, preventing multiple
  live instances from stacking up and flooding /api/nodes on reconnect.
- Add in-flight guard on /api/nodes fetch so concurrent requests are
  dropped if one is already in progress.
- Add dominant reason code column to Alerts tab (Most Impersonated
  Networks and Most Targeted Devices tables) and Sessions tab rows.
- README: document node dropout root cause (AP overwhelm on staggered
  power cycle), overnight stability confirmation, and dedicated AP todo.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 09:51:46 +03:00
bot 36c7248d0e Fix dashboard latency and add DB pruning
- Wrap all build_* route calls in asyncio.to_thread() so SQLite queries
  run in a thread pool instead of blocking the event loop. Fixes tab
  switch freezes and SSE stream stalls.
- Add 60s TTL caches to alerts, sessions, presence, and cross-node
  endpoints (previously uncached, queried on every request).
- Scope alerts queries (top targets, devices, reason breakdown, heatmap)
  to last 7 days instead of all-time full table scans.
- Add composite indexes: (bssid, received_at) on beacon_events and
  deauth_events, (src_mac, received_at) on probe_events.
- Add background pruning task: runs every 6 hours, deletes events older
  than HOT_DAYS from all tables, followed by WAL checkpoint.
- Document the full diagnosis and fixes in README.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 13:01:13 +03:00
bot fee23f0f66 dashboard changes for Session tab 2026-04-05 20:59:22 +03:00
bot e01bbd9e56 firmware&dashboard changes 2026-04-05 13:06:25 +03:00
bot 2636ea1e11 sligh changed to dashbaord 2026-04-05 11:29:59 +03:00
bot 5c0ec8cc5a Add deauth detection, Alerts tab, Search tab, node detail cards, UI improvements 2026-04-04 12:47:43 +03:00
bot fbf5b5c738 Add deauth/disassoc detection — firmware capture, coordinator ingestion, Alerts tab with burst detection 2026-04-03 22:24:25 +03:00
bot cbef4143ee Add Presence tab, RSSI chart, heartbeat; fix SSE flood, chart timezone, N+1 clients query 2026-04-03 21:50:41 +03:00
bot a73aae21ad ESP32 WiFi recon cluster 2026-04-03 14:38:38 +03:00