You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should be using tokio::spawn_blocking instead of tokio::spawn whenever we are doing sync long running processing inside a task. As this might block the current tokio's worker thread, and will not allow other tasks to progress.
We should be using
tokio::spawn_blocking
instead oftokio::spawn
whenever we are doingsync long running processing
inside a task. As this might block the current tokio's worker thread, and will not allow other tasks to progress.spawn_blocking
will use its own thread pool with individual system thread for each task. https://docs.rs/tokio/latest/tokio/task/fn.spawn_blocking.htmlWe can also use
tokio::fs
whenever we are doing fs operations? This would automatically upgrade the task to run in its own thread.The text was updated successfully, but these errors were encountered: