summaryrefslogtreecommitdiff
path: root/runtime/tokio_util.rs
diff options
context:
space:
mode:
authorhaturau <135221985+haturatu@users.noreply.github.com>2024-11-20 01:20:47 +0900
committerGitHub <noreply@github.com>2024-11-20 01:20:47 +0900
commit85719a67e59c7aa45bead26e4942d7df8b1b42d4 (patch)
treeface0aecaac53e93ce2f23b53c48859bcf1a36ec /runtime/tokio_util.rs
parent67697bc2e4a62a9670699fd18ad0dd8efc5bd955 (diff)
parent186b52731c6bb326c4d32905c5e732d082e83465 (diff)
Merge branch 'denoland:main' into main
Diffstat (limited to 'runtime/tokio_util.rs')
-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()
}