From 19b8a1686d2e48e54e62c044f31f32ced77d007a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 12 May 2020 14:23:57 +0200 Subject: [PATCH] client: Disable the sleeps on the wasm target for now. --- matrix_sdk/src/client.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/matrix_sdk/src/client.rs b/matrix_sdk/src/client.rs index 6c3fe1f0..9e176591 100644 --- a/matrix_sdk/src/client.rs +++ b/matrix_sdk/src/client.rs @@ -847,12 +847,13 @@ impl Client { let response = if let Ok(r) = response { r } else { - sleep::new(Duration::from_secs(1)).await; - continue; + #[cfg(not(target_arch = "wasm32"))] + { + sleep::new(Duration::from_secs(1)).await; + continue; + } }; - callback(response).await; - // TODO send out to-device messages here #[cfg(feature = "encryption")] @@ -874,14 +875,19 @@ impl Client { } } + callback(response).await; + let now = Instant::now(); // If the last sync happened less than a second ago, sleep for a // while to not hammer out requests if the server doesn't respect // the sync timeout. - if let Some(t) = last_sync_time { - if now - t <= Duration::from_secs(1) { - sleep::new(Duration::from_secs(1)).await; + #[cfg(not(target_arch = "wasm32"))] + { + if let Some(t) = last_sync_time { + if now - t <= Duration::from_secs(1) { + sleep::new(Duration::from_secs(1)).await; + } } }