Skip to content

Homeserver discovery state caching #1469

Open
@gnunicorn

Description

@gnunicorn

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgood first issueGood for newcomershelp wantedInterested in working on the project? These are great additions we'd like to have!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions