Skip to content
Snippets Groups Projects
Commit 51df9469 authored by Jason Volk's avatar Jason Volk
Browse files

de-branch duration limit statement


Signed-off-by: default avatarJason Volk <jason@zemos.net>
parent 23a90551
No related branches found
No related tags found
1 merge request!513Maintenance/Fixes
use std::{
cmp,
cmp::Ordering,
collections::{hash_map::Entry, BTreeMap, BTreeSet, HashMap, HashSet},
time::Duration,
......@@ -302,11 +303,8 @@ pub(crate) async fn sync_events_route(
{
// Hang a few seconds so requests are not spammed
// Stop hanging if new info arrives
let mut duration = body.timeout.unwrap_or_default();
if duration.as_secs() > 30 {
duration = Duration::from_secs(30);
}
let default = Duration::from_secs(30);
let duration = cmp::min(body.timeout.unwrap_or(default), default);
_ = 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
// Stop hanging if new info arrives
let mut duration = body.timeout.unwrap_or(Duration::from_secs(30));
if duration.as_secs() > 30 {
duration = Duration::from_secs(30);
}
let default = Duration::from_secs(30);
let duration = cmp::min(body.timeout.unwrap_or(default), default);
_ = tokio::time::timeout(duration, watcher).await;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment