matrix-org / matrix-org/matrix-rust-sdk
Use the new task monitor for long-lived background jobs
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.3k
- Forks
- 500
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 106
Description
https://github.com/matrix-org/matrix-rust-sdk/pull/6075 adds a mechanism to watch background jobs spawned with `tokio::spawn` that have failed (either with a panic, or with a `Result::Err`). The same PR introduced its usage in the event cache, but we should expand it to more places in the SDK, i.e. for every background task.
This is rather mechanical, and requires a bit of thought for each case. In particular, if a job is spawned in the background but awaited immediately, it should *not* use this mechanism; this is really for jobs that ought to live ~forever until the program dies (or aborted in rare cases).
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
Read PR 6075 and its event cache usage to understand the new task monitor. Search the SDK for background jobs spawned with tokio::spawn, then inspect each case to distinguish long-lived tasks from jobs awaited immediately. Done means long-lived background tasks use the monitor while immediately awaited jobs remain unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100