Tokio's spawn tasks and join handles

⚓ rust    📅 2025-07-05    👤 surdeus    👁️ 2      

surdeus

Assume there is a spawn task with a loop that keeps on invoking tokio::time::sleep(…).await and nothing else. The documentation says that dropping the join handle does not abort the task etc. Is it then guaranteed that the task will continue to be pulled and be progressing in general until the runtime is shut down, or is there some mechanism that disposes of or heavily deprioritizes detached, marginally active tasks? I have a background job that is supposed to stay alive, and it seems to die after some hours or days, but it also seems to help to keep the join handle around.

3 posts - 2 participants

Read full topic

🏷️ rust_feed