mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-03-31 17:15:35 +00:00
skip timeout offset for the first element in the ban index
This commit is contained in:
parent
f903d1e83f
commit
2486dabb38
1 changed files with 5 additions and 1 deletions
|
|
@ -47,7 +47,11 @@ impl Ban {
|
||||||
|
|
||||||
/// * return expiration time
|
/// * return expiration time
|
||||||
pub fn add(&mut self, key: Id20) -> DateTime<Local> {
|
pub fn add(&mut self, key: Id20) -> DateTime<Local> {
|
||||||
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());
|
assert!(self.index.insert(key, t).is_none());
|
||||||
t
|
t
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue