matrix-sdk: Use futures-timer's wasm-bindgen feature

master
stoically 2020-05-24 16:05:02 +02:00
parent b8a9e05ebb
commit 7edb42b75c
2 changed files with 4 additions and 8 deletions

View File

@ -23,7 +23,7 @@ serde_json = "1.0.53"
thiserror = "1.0.18" thiserror = "1.0.18"
tracing = "0.1.14" tracing = "0.1.14"
url = "2.1.1" url = "2.1.1"
futures-timer = "3.0.2" futures-timer = { version = "3.0.2", features = ["wasm-bindgen"] }
matrix-sdk-common = { version = "0.1.0", path = "../matrix_sdk_common" } matrix-sdk-common = { version = "0.1.0", path = "../matrix_sdk_common" }

View File

@ -858,7 +858,6 @@ impl Client {
let response = if let Ok(r) = response { let response = if let Ok(r) = response {
r r
} else { } else {
#[cfg(not(target_arch = "wasm32"))]
sleep::new(Duration::from_secs(1)).await; sleep::new(Duration::from_secs(1)).await;
continue; continue;
@ -892,12 +891,9 @@ impl Client {
// If the last sync happened less than a second ago, sleep for a // 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 // while to not hammer out requests if the server doesn't respect
// the sync timeout. // the sync timeout.
#[cfg(not(target_arch = "wasm32"))] if let Some(t) = last_sync_time {
{ if now - t <= Duration::from_secs(1) {
if let Some(t) = last_sync_time { sleep::new(Duration::from_secs(1)).await;
if now - t <= Duration::from_secs(1) {
sleep::new(Duration::from_secs(1)).await;
}
} }
} }