Skip to content

perf: optimize EventLog I/O, tailscale cache, frame encoding, and blur order - #26

Merged
johnoct merged 1 commit into
mainfrom
feat/perf-optimizations
Feb 7, 2026
Merged

perf: optimize EventLog I/O, tailscale cache, frame encoding, and blur order#26
johnoct merged 1 commit into
mainfrom
feat/perf-optimizations

Conversation

@johnoct

@johnoct johnoct commented Feb 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Cache get_tailscale_ip() with 60s TTL — eliminates subprocess.run(["ifconfig"]) on every /status poll
  • Add in-memory deque to EventLogget_events() reads from memory instead of parsing JSONL file
  • Remove per-event prune() calls from detection loop — sync to disk every 100 events instead
  • Skip cv2.imencode() when no web viewers connected via FrameBuffer.has_viewers()
  • Blur after ROI crop instead of before — reduces GaussianBlur work area proportional to ROI size

Closes #20

Test plan

  • All 259 tests pass (pytest tests/ -v)
  • Tailscale cache: cached hit, TTL expiry, None caching
  • EventLog in-memory: reads from memory, loads from disk on init, deque auto-prunes, sync_to_disk, disk error resilience
  • FrameBuffer: has_viewers true/false/timeout
  • Blur order: matches full-frame when no ROI, detects motion in ROI
  • Integration: JPEG skipped when no viewers, encoded when viewers connected
  • Existing tests updated for new behavior (skip-encode, no per-event prune)

…r order

- Cache get_tailscale_ip() with 60s TTL to avoid subprocess per /status poll
- Add in-memory deque to EventLog so get_events() skips file I/O
- Remove per-event prune() calls; sync to disk every 100 events instead
- Skip JPEG encode when no web viewers connected (FrameBuffer.has_viewers())
- Blur after ROI crop instead of before to reduce GaussianBlur work area
@johnoct
johnoct merged commit b9201cf into main Feb 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize event log I/O performance

1 participant