Skip to content

feat: add discovery_cache_timeout to ClientBuilder and rediscover() t…#6712

Draft
SIDHARTH20K4 wants to merge 4 commits into
matrix-org:mainfrom
SIDHARTH20K4:feat/discovery-cache-timeout
Draft

feat: add discovery_cache_timeout to ClientBuilder and rediscover() t…#6712
SIDHARTH20K4 wants to merge 4 commits into
matrix-org:mainfrom
SIDHARTH20K4:feat/discovery-cache-timeout

Conversation

@SIDHARTH20K4

@SIDHARTH20K4 SIDHARTH20K4 commented Jul 2, 2026

Copy link
Copy Markdown

The SDK makes fresh network requests on every startup to discover homeserver versions, well-known info, and other discovery data, even though this data rarely changes. This adds unnecessary latency and load on the homeserver.

This PR adds:

  • ClientBuilder::discovery_cache_timeout(Duration) to configure how long discovery data is considered fresh (default: 24h)
  • Client::rediscover() to force a refresh of all cached discovery data

Closes #1469

  • I've documented the public API changes in the appropriate changelog files (see Writing changelog entries).
  • This PR was made with the help of AI.

Signed-off-by: Sidharth sidharth.120504@gmail.com

…o Client

Signed-off-by: SIDHARTH20K4 <91970588+SIDHARTH20K4@users.noreply.github.com>
Signed-off-by: SIDHARTH20K4 <91970588+SIDHARTH20K4@users.noreply.github.com>
Signed-off-by: SIDHARTH20K4 <91970588+SIDHARTH20K4@users.noreply.github.com>
@codspeed-hq

codspeed-hq Bot commented Jul 9, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 50 untouched benchmarks


Comparing SIDHARTH20K4:feat/discovery-cache-timeout (40d0c09) with main (8980b4b)

Open in CodSpeed

Signed-off-by: SIDHARTH20K4 <91970588+SIDHARTH20K4@users.noreply.github.com>
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
510 1 509 0
View the top 1 failed test(s) by shortest run time
matrix-sdk::client::tests::test_rediscover
Stack Traces | 1.58s run time
thread 'client::tests::test_rediscover' (14485) panicked at .../src/client/mod.rs:3989:35:
called `Result::unwrap()` on an `Err` value: OAuth(Discovery(Http(Api(Server(MatrixError(Error { status_code: 404, body: NotJson { bytes: b"", deserialization_error: Error("EOF while parsing a value", line: 1, column: 0) } }))))))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

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.

Homeserver discovery state caching

1 participant