matrix-org / matrix-org/matrix-rust-sdk

Homeserver discovery state caching

Open
#1,469 5 comments 0 reactions 1 assignee View on GitHub

@SIDHARTH20K4 is already working on this.

Since Jun 11, 2026.

enhancement good first issue help wanted
Dominant language
Rust
Stars
2.3k
Forks
500
Avg merge
1d 16h
Merged PRs (30d)
106

Description

More and more information discovery is added in the Matrix-Spec. After the homeserver-versions and the exact domain, sliding sync is also adding the sliding-sync-proxy homeserver now. As of now the rust sdk need to make all these requests at every startup to resolve them or rely upon the higher level to hand it in (which is mostly hardcoded information at this point). Instead it would be great if we could define some caching mechanism for these that could automatically track when it was last refreshed and refresh them in certain intervals on long running processes or schedule a fetch when it notices they are stale at startup. Ideally these would also be persisted in the store for faster startup without remote requests.

I see two more functions added to the external interface to support for that. On ClientBuilder we want to configure the discovery_cache_timeout(stale_timeout: Duration) (but the default should just be 24h, I'd say) and on client itself we should have rediscover() that force triggers the requests to refresh those discovery states.

Internally, I'd expect this to store the data itself and the datetime it was received persistently as well as in memory for faster access and refresh the state discovery through the outgoing_requests-interface whenever that is necessary (so some scheduler would be necessary).

We probably want to have tests for that... probably with a mocked server with changing discovery data to ensure all parts of the app actually received that new information as soon as it is available.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.