summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/tokio_util.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/runtime/tokio_util.rs b/runtime/tokio_util.rs
index 0d81f6e23..aa0282ece 100644
--- a/runtime/tokio_util.rs
+++ b/runtime/tokio_util.rs
@@ -43,7 +43,15 @@ pub fn create_basic_runtime() -> tokio::runtime::Runtime {
// parallel for deno fmt.
// The default value is 512, which is an unhelpfully large thread pool. We
// don't ever want to have more than a couple dozen threads.
- .max_blocking_threads(32)
+ .max_blocking_threads(if cfg!(windows) {
+ // on windows, tokio uses blocking tasks for child process IO, make sure
+ // we have enough available threads for other tasks to run
+ 4 * std::thread::available_parallelism()
+ .map(|n| n.get())
+ .unwrap_or(8)
+ } else {
+ 32
+ })
.build()
.unwrap()
}