-
Notifications
You must be signed in to change notification settings - Fork 265
Open
Milestone
Description
Iroh's use of tokio
is very particular/opinionated.
- No use of
tokio::spawn
without wrapping theJoinHandle
withAbortOnDropHandle
- No use of
JoinSet::spawn
without 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 withelse
insidetokio::select!
, see refactor(iroh, iroh-relay): JoinSet disabling in tokio::select! #3052 ) - Every
spawn
must 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
No status