Skip to content

Commit a50bd46

Browse files
author
RedZapdos123
committed
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 <xerontitan90@gmail.com>
1 parent ac7e8c8 commit a50bd46

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

plotly_static/src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ impl AsyncStaticExporter {
10591059
client.goto(&url).await?;
10601060

10611061
#[cfg(target_os = "windows")]
1062-
Self::wait_for_document_ready(&client, std::time::Duration::from_secs(10)).await?;
1062+
Self::wait_for_document_ready(&client, std::time::Duration::from_secs(20)).await?;
10631063

10641064
// Wait for Plotly container element
10651065
#[cfg(target_os = "windows")]
@@ -1200,13 +1200,13 @@ impl AsyncStaticExporter {
12001200
if has_el.as_bool().unwrap_or(false) {
12011201
return Ok(());
12021202
}
1203+
if start.elapsed() > timeout {
1204+
return Err(anyhow!(
1205+
"Timeout waiting for #plotly-html-element to appear in DOM"
1206+
));
1207+
}
1208+
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
12031209
}
1204-
if start.elapsed() > timeout {
1205-
return Err(anyhow!(
1206-
"Timeout waiting for #plotly-html-element to appear in DOM"
1207-
));
1208-
}
1209-
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
12101210
}
12111211

12121212
#[cfg(target_os = "windows")]

0 commit comments

Comments
 (0)