-
Notifications
You must be signed in to change notification settings - Fork 329
Closed
Milestone
Description
Iroh's use of tokio is very particular/opinionated.
- No use of
tokio::spawnwithout wrapping theJoinHandlewithAbortOnDropHandle - No use of
JoinSet::spawnwithout some loop somewhere callingtasks.join_next().await, if !tasks.is_empty()(to avoid leaking memory from task results accumulating) (EDIT: this might only be necessary if used withelseinsidetokio::select!, see refactor(iroh, iroh-relay): JoinSet disabling in tokio::select! #3052 ) - Every
spawnmust use an.instrument()for tracing.
Furthermore, for iroh in the browser (#2799) we will need to abstract away all tokio::spawn usage because it's not available in the browser! (I've already implemented a JoinSet alternative on top of wasm_bindgen_futures for exactly that reason)
Given that such an indirection would have to be created for the browser work anyways, this might be a good opportunity to introduce an API at that indirection that avoids all of the above footguns (forgetting .instrument(), leaking tasks, leaking memory).
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
✅ Done