Skip to content

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
mainfrom
fix/messages-unfurl-cache-and-bound
Open

unRekable wants to merge 1 commit into
mainfrom
fix/messages-unfurl-cache-and-bound

Conversation

@unRekable

Copy link
Copy Markdown
Collaborator

What changed and why

The first part of #1011 is on main since #1028: a connection no longer re-reads every chat back to its first message. Three things were open.

  • One thread per link. maybe_unfurl started 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.
  • Nothing was remembered over a restart. The links that were looked up and have no preview are now kept in the store (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.
  • The Verify step had no test. The scripted phone now says when a chat's list last changed, and a test connects twice: the second connection asks for no page of a chat nothing arrived in.

Type

  • feature
  • fix
  • perf
  • refactor
  • chore
  • docs

Platforms

  • windows
  • macos
  • linux
  • android
  • ios

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 way crates/chatd/tests/messages.rs does, 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, then cargo nextest run --workspace --features tinyclient/gui (3685 passed, 28 skipped; seven new tests among them, three on the scripted wire), then cargo 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.

…ed over a restart, and asks for no page again that an unchanged chat already read
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant