perf(core,memory,tui): eliminate blocking I/O in async hot paths#914
Merged
perf(core,memory,tui): eliminate blocking I/O in async hot paths#914
Conversation
This was
linked to
issues
Feb 25, 2026
Closed
c82d654 to
f3e9108
Compare
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
f3e9108 to
7ef4f2f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #889, #890, #891, #892, #893
Epic: #862
Summary
send_status()calls frompersist_message()— Telegram status updates are blocking API calls that do not belong in the SQLite WAL insert pathCOUNT(*)SQL query incheck_summarization()with in-memoryunsummarized_count: usizeonMemoryState— counter increments on persist, resets on summarizationResponseCache::cleanup_expired()as a backgroundtokio::spawntask at configurable interval ([memory] response_cache_cleanup_interval_secs, default 3600s)terminal.draw()intui_loop()when dirty flag is unset — eliminates widget render/diff on idle 250ms tickssqlite_pool_size: u32toMemoryConfig(default 5,[memory] sqlite_pool_size) wired intoSqliteStoreconnection pool builderTest plan
cargo +nightly fmt --check— cleancargo clippy --workspace -- -D warnings— 0 warningscargo nextest run --workspace --lib --bins— 2804/2804 passed (6 new tests for counter logic and pool size config)config_default_snapshot.snap