client: Disable the sleeps on the wasm target for now.
parent
ef6104bc53
commit
19b8a1686d
|
@ -847,12 +847,13 @@ 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;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
callback(response).await;
|
|
||||||
|
|
||||||
// TODO send out to-device messages here
|
// TODO send out to-device messages here
|
||||||
|
|
||||||
#[cfg(feature = "encryption")]
|
#[cfg(feature = "encryption")]
|
||||||
|
@ -874,16 +875,21 @@ impl Client {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
callback(response).await;
|
||||||
|
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
|
|
||||||
// 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 let Some(t) = last_sync_time {
|
||||||
if now - t <= Duration::from_secs(1) {
|
if now - t <= Duration::from_secs(1) {
|
||||||
sleep::new(Duration::from_secs(1)).await;
|
sleep::new(Duration::from_secs(1)).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
last_sync_time = Some(now);
|
last_sync_time = Some(now);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue