From a50bd464931a8598a406bff592d0c58706dd67d1 Mon Sep 17 00:00:00 2001 From: RedZapdos123 Date: Tue, 2 Jun 2026 13:48:44 +0530 Subject: [PATCH] fix: harden windows export readiness A flaky windows-latest Chrome CI run timed out waiting for document.readyState during image_to_svg_string even though the page finished loading immediately afterward. Increase the Windows-only document readiness timeout and fix the plotly container wait loop so the timeout path behaves as intended. Signed-off-by: Mridankan Mandal --- plotly_static/src/lib.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plotly_static/src/lib.rs b/plotly_static/src/lib.rs index 804e19e9..42f23b86 100644 --- a/plotly_static/src/lib.rs +++ b/plotly_static/src/lib.rs @@ -1059,7 +1059,7 @@ impl AsyncStaticExporter { client.goto(&url).await?; #[cfg(target_os = "windows")] - Self::wait_for_document_ready(&client, std::time::Duration::from_secs(10)).await?; + Self::wait_for_document_ready(&client, std::time::Duration::from_secs(20)).await?; // Wait for Plotly container element #[cfg(target_os = "windows")] @@ -1200,13 +1200,13 @@ impl AsyncStaticExporter { if has_el.as_bool().unwrap_or(false) { return Ok(()); } + if start.elapsed() > timeout { + return Err(anyhow!( + "Timeout waiting for #plotly-html-element to appear in DOM" + )); + } + tokio::time::sleep(std::time::Duration::from_millis(50)).await; } - if start.elapsed() > timeout { - return Err(anyhow!( - "Timeout waiting for #plotly-html-element to appear in DOM" - )); - } - tokio::time::sleep(std::time::Duration::from_millis(50)).await; } #[cfg(target_os = "windows")]