summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-05-08 11:46:12 -0400
committerGitHub <noreply@github.com>2024-05-08 15:46:12 +0000
commit0e9b7f64f76381e48e20742c7d0682fd8e61f7d4 (patch)
tree030c9a906985f98a6fd7b9fcc12360772233477f
parent5e6c72d39fc6bf809a71e4074e7d6f516d18486a (diff)
chore: speed up test_multi_task test on Windows (#23737)
Previously it was around 30s to run: 1024*2*15 = 30720ms
-rw-r--r--ext/web/stream_resource.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/web/stream_resource.rs b/ext/web/stream_resource.rs
index b96ac36bc..54ebf775a 100644
--- a/ext/web/stream_resource.rs
+++ b/ext/web/stream_resource.rs
@@ -650,7 +650,13 @@ mod tests {
// Slightly slower reader
let b = deno_core::unsync::spawn(async move {
for _ in 0..BUFFER_CHANNEL_SIZE * 2 {
- tokio::time::sleep(Duration::from_millis(1)).await;
+ if cfg!(windows) {
+ // windows has ~15ms resolution on sleep, so just yield so
+ // this test doesn't take 30 seconds to run
+ tokio::task::yield_now().await;
+ } else {
+ tokio::time::sleep(Duration::from_millis(1)).await;
+ }
poll_fn(|cx| channel.poll_read_ready(cx)).await;
channel.read(BUFFER_AGGREGATION_LIMIT).unwrap();
}