From: Ian Jackson Date: Sun, 22 Aug 2021 17:16:55 +0000 (+0100) Subject: wip, fixes, still no early return apparently X-Git-Tag: hippotat/1.0.0~94 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=0c02b6d45f43a852431d4c92f0be229c9dbe9194;p=hippotat.git wip, fixes, still no early return apparently Signed-off-by: Ian Jackson --- diff --git a/server/suser.rs b/server/suser.rs index 69bbf87..cd32105 100644 --- a/server/suser.rs +++ b/server/suser.rs @@ -51,11 +51,16 @@ pub async fn run(global: Arc, .sat(); if let Some(req) = { + let now = Instant::now(); + if ! downbound.is_empty() { outstanding.pop_front() } else if let Some((i,_)) = outstanding.iter().enumerate().find({ - |(_,o)| outstanding.len() > o.oi.target_requests_outstanding.sat() - // xxx need timeout-based return too + |(_,o)| { + outstanding.len() > o.oi.target_requests_outstanding.sat() + || + o.oi.deadline < now + } }) { Some(outstanding.remove(i).unwrap()) } else { @@ -91,6 +96,7 @@ pub async fn run(global: Arc, while downbound.total_len() > max { let _ = downbound.pop_front(); + trace!("{} discarding downbound-queue-full", &ic.link); } select!{