From ac508a9e9c0062579ebae06d30f0828707289c1a Mon Sep 17 00:00:00 2001 From: Simon Laux Date: Wed, 17 Apr 2024 02:05:59 +0200 Subject: [PATCH] replace tokio sleep with `SystemTime::shift` --- src/events/chatlist_events.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/events/chatlist_events.rs b/src/events/chatlist_events.rs index cc58cb37b..8d4e0bfa7 100644 --- a/src/events/chatlist_events.rs +++ b/src/events/chatlist_events.rs @@ -79,6 +79,7 @@ mod test_chatlist_events { EventType, }; + use crate::tools::SystemTime; use anyhow::Result; async fn wait_for_chatlist_and_specific_item(context: &TestContext, chat_id: ChatId) { @@ -352,7 +353,7 @@ mod test_chatlist_events { ); chat::set_muted(&alice, chat, mute_duration).await?; alice.evtracker.clear_events(); - tokio::time::sleep(Duration::from_secs(3)).await; + SystemTime::shift(Duration::from_secs(3)); wait_for_chatlist_specific_item(&alice, chat).await; Ok(()) @@ -521,7 +522,7 @@ mod test_chatlist_events { let _ = chat::send_text_msg(&alice, chat, "Hello".to_owned()).await?; alice.evtracker.clear_events(); - tokio::time::sleep(Duration::from_secs(2)).await; + SystemTime::shift(Duration::from_secs(3)); wait_for_chatlist_and_specific_item(&alice, chat).await; Ok(())