matrix-org / matrix-org/complement-crypto
Add waiters to events
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 18
- Forks
- 12
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
We currently need to do things like https://github.com/matrix-org/complement-crypto/blob/f8712271d573f4f0a33240ab9c1a2fdb4372bd91/tests/to_device_test.go#L186 because we don't listen for changes to the state of an event. This is flakey and has caused intermittent failures in this test and likely others.
Instead, we should hook into the timeline update code and every time we see our target event ID we should emit an update on a channel for it. That way, we can use the waiter pattern of "wait until this happens and give up after N seconds" which is far more reliable as N can be large without affecting the runtime of the test in the happy case.
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 with tests/to_device_test.go around line 186 and trace the timeline update code that observes event state. Determine how a target event ID can notify a channel and how callers can wait with a timeout. Done means the test no longer relies on flaky polling and the waiter gives up after the requested timeout.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100