perf: introduce windowed message storage API - #554
Merged
Conversation
The primary key on arrived_at alone was globally unique, so REPLACE in store_message could silently delete a message with the same timestamp in another channel. The composite key matches the semantics of MessageId and serves as the index for windowed message queries. Also link messages to their channel via a foreign key (deleting a channel deletes its messages), and remove Storage::message_channel, which is ambiguous under the composite key.
The app was not starting with: `Error: The cursor position could not be read within a normal duration.` The problem was most likely twofold: first `cargo install --path .` ignored the lockfile. Further ratatui was upgraded and now probes the terminal in `terminal.clear` which was blocked by already started event stream. This commit upgrades ratatui and corresponding dependencies, and open event reading *after* clearing the screen.
boxdot
marked this pull request as draft
June 15, 2026 08:54
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.
Messages were held in an in-memory cache (MemCache) over the storage
backend, loading a channel's whole history into memory. Replace it with
a windowed API: the app requests a bounded window around the selection
and refills it every frame, so memory usage is constant regardless of
channel size.
This significantly improves the memory usage and start up time of the app.