qauld-ctl tui Refactor: qauld tui async refresh (without demo script) - #935
Merged
Merged
Conversation
The refresh cycle used to run inline in the render loop's tokio::select tick arm: eight RPCs awaited one after another, each on a fresh socket. While it ran, no keystrokes or redraws were processed — and if the daemon was slow or unreachable, the loop froze for up to (8 fetches x timeout) per cycle (~40s at the 5s default), making the whole UI feel dead. Move polling into a dedicated background task: - data::refresh_once fans the fetches out concurrently (tokio::join!) after resolving the default user first (the DTN fetches need its id), so a cycle costs one round-trip's latency instead of the sum of eight. It returns a Send-able Snapshot (Result<_, String> fields). - The task loops on an interval (first tick immediate → non-blocking prime) plus a manual-trigger channel, and posts each Snapshot to the render loop over an mpsc. - The render loop's select now has a snapshot arm that calls the pure, synchronous apply_snapshot — no .await on network anywhere in the loop. 'r' and post-feed-send just fire the trigger. Crypto-event dedup: the poll floor now lives with the task (sole owner of the poll path), so the daemon's inclusive since_ms filter re-sends the boundary event each cycle. append_crypto_events now routes every event through the same dedup as the push path (merge_crypto_event), so poll/push overlaps and boundary re-sends are dropped without the two paths sharing a floor. Tests: three append_crypto_events dedup cases (boundary re-send, push/poll overlap, distinct-same-timestamp). Verified live against two daemons — 22/22 feature checks still pass — plus a daemon-death probe: with every fetch hitting the 5s timeout, tab switches still register in ~50ms (identical to daemon-alive), where the old design would have frozen for up to 40s.
MathJud
force-pushed
the
refactor/qauld-tui-async-refresh-without-demo
branch
from
August 5, 2026 14:40
8bd187b to
c4a574a
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.



TUI changes of #929 without the demo script
Polling used to run inline in the render loop's select tick — 8 RPCs awaited sequentially, freezing input/redraws while they ran and up to ~40s/cycle if the daemon was unreachable. Move polling to a background task: refresh_once fans the fetches out concurrently (one round-trip's latency, not eight) and posts a Send-able Snapshot to the loop, which applies it synchronously. No network .await anywhere in the loop. r and post-feed-send just fire a trigger.
Crypto events now dedup through one path (the poll floor lives with the task), so poll/push overlaps and the daemon's inclusive since_ms re-sends are dropped. Three new dedup unit tests.