de-branch duration limit statement
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
23a9055199
commit
51df946911
1 changed files with 5 additions and 10 deletions
|
@ -1,4 +1,5 @@
|
||||||
use std::{
|
use std::{
|
||||||
|
cmp,
|
||||||
cmp::Ordering,
|
cmp::Ordering,
|
||||||
collections::{hash_map::Entry, BTreeMap, BTreeSet, HashMap, HashSet},
|
collections::{hash_map::Entry, BTreeMap, BTreeSet, HashMap, HashSet},
|
||||||
time::Duration,
|
time::Duration,
|
||||||
|
@ -302,11 +303,8 @@ pub(crate) async fn sync_events_route(
|
||||||
{
|
{
|
||||||
// Hang a few seconds so requests are not spammed
|
// Hang a few seconds so requests are not spammed
|
||||||
// Stop hanging if new info arrives
|
// Stop hanging if new info arrives
|
||||||
let mut duration = body.timeout.unwrap_or_default();
|
let default = Duration::from_secs(30);
|
||||||
if duration.as_secs() > 30 {
|
let duration = cmp::min(body.timeout.unwrap_or(default), default);
|
||||||
duration = Duration::from_secs(30);
|
|
||||||
}
|
|
||||||
|
|
||||||
_ = tokio::time::timeout(duration, watcher).await;
|
_ = tokio::time::timeout(duration, watcher).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1560,11 +1558,8 @@ pub(crate) async fn sync_events_v4_route(
|
||||||
{
|
{
|
||||||
// Hang a few seconds so requests are not spammed
|
// Hang a few seconds so requests are not spammed
|
||||||
// Stop hanging if new info arrives
|
// Stop hanging if new info arrives
|
||||||
let mut duration = body.timeout.unwrap_or(Duration::from_secs(30));
|
let default = Duration::from_secs(30);
|
||||||
if duration.as_secs() > 30 {
|
let duration = cmp::min(body.timeout.unwrap_or(default), default);
|
||||||
duration = Duration::from_secs(30);
|
|
||||||
}
|
|
||||||
|
|
||||||
_ = tokio::time::timeout(duration, watcher).await;
|
_ = tokio::time::timeout(duration, watcher).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue