|
|
|
@ -175,7 +175,7 @@ async fn sync_helper_wrapper( |
|
|
|
let _ = tx.send(Some(r.map(|(r, _)| r.into()))); |
|
|
|
let _ = tx.send(Some(r.map(|(r, _)| r.into()))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const THIRTY_SECONDS: Duration = Duration::from_secs(30); |
|
|
|
const SYNC_TIMEOUT: Duration = Duration::from_secs(30); |
|
|
|
|
|
|
|
|
|
|
|
#[tracing::instrument(skip(db))] |
|
|
|
#[tracing::instrument(skip(db))] |
|
|
|
async fn sync_helper( |
|
|
|
async fn sync_helper( |
|
|
|
@ -212,7 +212,7 @@ async fn sync_helper( |
|
|
|
&& response.device_one_time_keys_count.is_empty() |
|
|
|
&& response.device_one_time_keys_count.is_empty() |
|
|
|
{ |
|
|
|
{ |
|
|
|
// ...we wait until we get new data, or until timeout.
|
|
|
|
// ...we wait until we get new data, or until timeout.
|
|
|
|
if tokio::time::timeout(timeout.unwrap_or_default().min(THIRTY_SECONDS), watcher) |
|
|
|
if tokio::time::timeout(timeout.unwrap_or_default().min(SYNC_TIMEOUT), watcher) |
|
|
|
.await |
|
|
|
.await |
|
|
|
.is_ok() |
|
|
|
.is_ok() |
|
|
|
// But if we get new data (is_err is timeout)...
|
|
|
|
// But if we get new data (is_err is timeout)...
|
|
|
|
|