element-hq / element-hq/synapse

/sync returns outdated OTK counts

Open
#17,491 4 comments 0 reactions 0 assignees View on GitHub
A-E2EE A-Sync O-Frequent S-Minor T-Defect
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

Typically, the way that `/sync` works is this:

* Assuming that anything at all has changed on the server since the `since` token, call `current_sync_for_user` to generate a sync response and new sync token.
* If nothing has happened in any of the syncing user's rooms, wait for a notification that something interesting has happened.
* If we get woken up, generate a new sync response and token.
* If nothing happens in 30 seconds, return the previously-generated response and token.

This means that, if the user is in no active rooms, the entire sync response and token are 30 seconds old.

This is particularly bad if the client uploads some OTKs in that 30-second slot, since the `/sync` response will include the OTK count from *before* the upload request.

The upshot of all this is that most clients end up uploading 100 keys when really they only meant to upload 50.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.