Repository navigation
Google Messages asks for no page again that a chat already read, and looks links up one at a time - #1043
Open
unRekable wants to merge 1 commit into
Open
Google Messages asks for no page again that a chat already read, and looks links up one at a time#1043unRekable wants to merge 1 commit into
unRekable wants to merge 1 commit into
Conversation
…ed over a restart, and asks for no page again that an unchanged chat already read
4 of 11 tasks
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.
What changed and why
The first part of #1011 is on
mainsince #1028: a connection no longer re-reads every chat back to its first message. Three things were open.maybe_unfurlstarted a thread for every link it met, with no upper bound. Links now wait in one queue of at most 64 that one thread reads in turn. Past the queue a link is left without a preview until its message is read again.messages-unfurls), at most 256, so a restart does not ask for their pages again. A link with a preview keeps it on its message. A link longer than 2048 bytes is looked up each time and not kept.Type
Platforms
Proof
Scenario: e2e/scenarios/messages-restart-asks-nothing-again
The scenario starts this build's chatd on the scripted phone (
TINYCLIENT_MESSAGES_FAKE), steers it the waycrates/chatd/tests/messages.rsdoes, speaks chatd's socket, and runs a page server on loopback that counts what chatd asks it for. The phone scripts Grace's chat with a hundred lines. The first run reads the chat back to its first line and shows two links from Grace. chatd is stopped and started again on the same directory. The fixed build asks the phone for no page of the unchanged chat, fetches neither link again, and looks six links up one at a time. A build from before the change asks for the newest page again, fetches the link without a preview again, and fetches the six at once, so this driver fails there.Lab run: not made. The driver was not run against the real chatd on a lab host.
Also run on this branch on Windows before this pull request:
cargo build --workspace --all-targets --features tinyclient/gui, thencargo nextest run --workspace --features tinyclient/gui(3685 passed, 28 skipped; seven new tests among them, three on the scripted wire), thencargo test --workspace --doc --features tinyclient/gui.Not shown: anything against a real phone or a real page. The scripted phone stands in for the relay.
Compatibility
No protocol change. The kept links are one note in chatd's own store; a store without the note starts with nothing kept, and reads every chat once more on the first connection, as before.
Risk and rollback
A link that had no preview once is never asked for again on this device until its note is gone. That is what the issue asks for. Revert the commit; the note can stay.
Release note
Google Messages asks for no page again that a chat already read, fetches no link again it looked up before, and looks links up one at a time.
Part of #1011. Left: on an installation from before this change, the first connection after the update still reads every chat once.