Skip to content

How to handle long running blocking calls? #2045

Answered by syphar
overthetop asked this question in Q&A
Discussion options

You must be logged in to vote

It looks like the request will wait for the task to finish, right?

The "default" way to do this is to use tokio::task::spawn_blocking, which uses a separate threadpool, with configurable size.

You can also totally use a separate threadpool for this, as long as you asynchronously wait for the task.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by overthetop
Comment options

You must be logged in to vote
1 reply
@overthetop
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants