From 2486dabb38327cd96ce139ee28381fda3124c561 Mon Sep 17 00:00:00 2001 From: yggverse Date: Thu, 14 Aug 2025 02:03:47 +0300 Subject: [PATCH] skip timeout offset for the first element in the ban index --- src/ban.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ban.rs b/src/ban.rs index 330125a..af60436 100644 --- a/src/ban.rs +++ b/src/ban.rs @@ -47,7 +47,11 @@ impl Ban { /// * return expiration time pub fn add(&mut self, key: Id20) -> DateTime { - let t = self.index.values().max().map_or(Local::now(), |t| *t) + self.timeout; + let t = self + .index + .values() + .max() + .map_or(Local::now(), |t| *t + self.timeout); assert!(self.index.insert(key, t).is_none()); t }