Skip to content

perf(core,memory,tui): eliminate blocking I/O in async hot paths#914

Merged
bug-ops merged 1 commit intomainfrom
feat/862-async-efficiency
Feb 25, 2026
Merged

perf(core,memory,tui): eliminate blocking I/O in async hot paths#914
bug-ops merged 1 commit intomainfrom
feat/862-async-efficiency

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Feb 25, 2026

Closes #889, #890, #891, #892, #893
Epic: #862

Summary

  • Remove send_status() calls from persist_message() — Telegram status updates are blocking API calls that do not belong in the SQLite WAL insert path
  • Replace COUNT(*) SQL query in check_summarization() with in-memory unsummarized_count: usize on MemoryState — counter increments on persist, resets on summarization
  • Schedule ResponseCache::cleanup_expired() as a background tokio::spawn task at configurable interval ([memory] response_cache_cleanup_interval_secs, default 3600s)
  • Skip terminal.draw() in tui_loop() when dirty flag is unset — eliminates widget render/diff on idle 250ms ticks
  • Add sqlite_pool_size: u32 to MemoryConfig (default 5, [memory] sqlite_pool_size) wired into SqliteStore connection pool builder

Test plan

  • cargo +nightly fmt --check — clean
  • cargo clippy --workspace -- -D warnings — 0 warnings
  • cargo nextest run --workspace --lib --bins — 2804/2804 passed (6 new tests for counter logic and pool size config)
  • Snapshot updated: config_default_snapshot.snap

Closes #889, #890, #891, #892, #893

- Remove 4 send_status() calls from persist_message(); Telegram status
  updates are blocking API calls, SQLite WAL inserts do not warrant them
- Replace COUNT(*) SQL in check_summarization() with in-memory
  unsummarized_count: usize on MemoryState; reset on summarization
- Schedule ResponseCache::cleanup_expired() as a background tokio task
  at configurable interval (default 3600s); first tick skipped
- Skip terminal.draw() in tui_loop() when dirty flag is unset, reducing
  idle CPU on 250ms ticks
- Add sqlite_pool_size: u32 to MemoryConfig (default 5) wired into
  SqliteStore connection pool builder; SqliteStore::with_pool_size()
  and SemanticMemory::with_*_pool_size() constructors added
@bug-ops bug-ops force-pushed the feat/862-async-efficiency branch from f3e9108 to 7ef4f2f Compare February 25, 2026 22:12
@bug-ops bug-ops enabled auto-merge (squash) February 25, 2026 22:13
@bug-ops bug-ops merged commit 3e7781a into main Feb 25, 2026
28 checks passed
@bug-ops bug-ops deleted the feat/862-async-efficiency branch February 25, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core documentation Improvements or additions to documentation memory Persistence and memory performance Performance optimization rust size/L

Projects

None yet

1 participant