Fix flakey windows tests (#2332)

This commit is contained in:
Evan Almloff authored and GitHub committed 2024-04-17 15:08:38 -07:00
1 parent c9ab09b348
commit 5ce91e1bfc
31 files changed
+217 -136

No files matched your search

-1
View File
@@ -1,4 +1,3 @@
use crate::dioxus_elements::SerializedMouseData;
use dioxus::prelude::*;
use dioxus_core::ElementId;
use dioxus_elements::SerializedHtmlEventConverter;
+4 -2
View File
@@ -66,7 +66,7 @@ async fn spawn_forever_persists() {
#[component]
fn Child() -> Element {
spawn_forever(async move {
loop {
for _ in 0..10 {
POLL_COUNT.fetch_add(1, Ordering::Relaxed);
tokio::time::sleep(Duration::from_millis(50)).await;
}
@@ -82,7 +82,9 @@ async fn spawn_forever_persists() {
tokio::select! {
_ = dom.wait_for_work() => {}
_ = tokio::time::sleep(Duration::from_millis(500)) => {}
// We intentionally wait a bit longer than 50ms*10 to make sure the test has time to finish
// Without the extra time, the test can fail on windows
_ = tokio::time::sleep(Duration::from_millis(1000)) => {}
};
// By the time the tasks are finished, we should've accumulated ticks from two tasks