Enable thread pool for blocking ops (#3912)

This commit is contained in:
Ryan Dahl 2020-02-07 17:54:44 -05:00 committed by GitHub
parent 99186dbaa2
commit 724e39f13f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 11 deletions

View file

@ -103,15 +103,7 @@ where
if is_sync {
Ok(JsonOp::Sync(f()?))
} else {
// TODO(ry) use thread pool.
let fut = crate::tokio_util::spawn_thread(f);
/*
let fut = async move {
tokio::task::spawn_blocking(move || f())
.await
.map_err(ErrBox::from)?
}.boxed_local();
*/
let fut = async move { tokio::task::spawn_blocking(f).await.unwrap() };
Ok(JsonOp::Async(fut.boxed_local()))
}
}