matrix-org / matrix-org/matrix-rust-sdk
Event handlers for state events are sometimes called twice
- Dominant language
- Rust
- Stars
- 2.3k
- Forks
- 500
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 106
Description
While developing a bot using the matrix-rust-sdk, I have observed that event handlers for state events (in my case `OriginalRoomMemberEvent`) are occasionally called twice when a state event arrives. `Client::handle_sync_timeline_events` always calls the handler, but sometimes `Client::handle_sync_state_events` also calls it. This behavior makes it difficult to write a bot that needs to respond to state events, unless the event handlers can be made idempotent.
Contributor guide
Research direction
Start by reading Client::handle_sync_timeline_events and Client::handle_sync_state_events, then trace how a state event reaches each path during sync. Confirm the duplicate-callback case with an OriginalRoomMemberEvent and define done as each state event handler being called once per arrival.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100