TUI: watermark-based refresh on quiet inbox #3
Labels
No labels
needs-triage
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
arne/msg#3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The TUI re-runs
store.Peers()andstore.MessagesWithPeer()every 250ms, regardless of whether anything changed. On a quiet inbox this is wasteful (two SQLite queries per tick × the TUI's lifetime). With WAL it doesn't break anything, but it's churn for nothing.Proposal
Track the highest message rowid the TUI has observed. On each tick:
MAX(id) FROM messages(one cheap query against the primary key).Equivalent shapes (e.g. a small in-process pubsub from the daemon side, or SQLite's
update_hook) are also fine, but the watermark is the simplest correct thing.Acceptance criteria
SELECT MAX(id)queryContext
Surfaced in the v1.0.0 self-review. Not a v1 blocker; perf-only.