element-hq / element-hq/synapse
/sync returns outdated OTK counts
- 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
Assessment
This issue has not been assessed yet.