Skip to content

Commit 63af71d

Browse files
Reduce port timeout
1 parent 0150c5b commit 63af71d

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

xtask/src/e2e.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,15 @@ use std::time::{Duration, Instant};
2424
use crate::process::{self, ManagedChild, ReservedPort};
2525
use crate::util;
2626

27-
/// Maximum time to wait for all server ports to become ready.
28-
const PORT_TIMEOUT: Duration = Duration::from_secs(180);
27+
/// Maximum time to wait for a server port to become ready.
28+
/// CI environments are slower; local servers should be up almost instantly.
29+
fn port_timeout() -> Duration {
30+
if std::env::var_os("CI").is_some() {
31+
Duration::from_secs(60)
32+
} else {
33+
Duration::from_secs(5)
34+
}
35+
}
2936
const WORKSPACE_PACKAGES: &[&str] = &["@microsoft/webui-framework", "@microsoft/webui-router"];
3037

3138
/// A Playwright suite with optional long-lived server processes.
@@ -265,18 +272,19 @@ pub fn run(args: &[String]) -> ExitCode {
265272
.iter()
266273
.flat_map(|suite| suite.ports.iter().map(|p| (*p, suite.name)))
267274
.collect();
275+
let timeout = port_timeout();
268276
for (port, app_name) in &all_ports {
269277
if ctrlc.load(Ordering::SeqCst) {
270278
kill_servers(&mut servers);
271279
return ExitCode::SUCCESS;
272280
}
273-
if !wait_for_port(*port, PORT_TIMEOUT, &ctrlc) {
281+
if !wait_for_port(*port, timeout, &ctrlc) {
274282
eprintln!(
275283
" {} Port {} ({}) did not become ready within {}s",
276284
console::style("✘").red(),
277285
console::style(port).bold(),
278286
app_name,
279-
PORT_TIMEOUT.as_secs(),
287+
timeout.as_secs(),
280288
);
281289
kill_servers(&mut servers);
282290
return ExitCode::FAILURE;

0 commit comments

Comments
 (0)