matrix-org / matrix-org/matrix-rust-sdk
Guard against incompatible combination of sync calls
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.3k
- Forks
- 500
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 106
Description
Is your feature request related to a problem? Please describe.
Currently it's possible to sync and additionally do sync_once after it. This can have side-effects such as
- your sync that arrives second might get thrown out because we already handled the sync with that token
- your sync that arrives second might be the same one as the one that gets currently processed, overwriting stuff that's already written, a ~costly noop
- your sync that arrives second might be newer than what is currently being processed, i think that this might be fine, you're just overwriting the latest state
- your sync that arrives second might be older than the current sync, overwriting new state with old state
Describe the solution you'd like
Doing a sync call which might have side-effects could error or panic. In the specific case of doing a sync first, it could set a flag internally that a sync is running, and a sync_once call happening after that could then error or panic if the sync flag is set.
Matrix context: https://matrix.to/#/!iYnZafYUoXkeVPOSQh:matrix.org/$SJv7N73YFIg9UAlfxIfaUUYI4U13EIyi06Foq3m6wsg?via=matrix.org&via=famedly.de&via=kde.org
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the sync and sync_once APIs and reading how they track or process sync state. Determine how an incompatible second call should be reported, including the cases described in the issue, then add coverage that verifies the chosen behavior for each relevant call combination.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100