hunter/scheduler: fix fetch interval reporting
This commit is contained in:
parent
6231884d36
commit
08e920e247
|
@ -93,19 +93,16 @@ impl Scheduler {
|
||||||
if let Some(time) = self.queue.keys().next().cloned() {
|
if let Some(time) = self.queue.keys().next().cloned() {
|
||||||
if time <= now {
|
if time <= now {
|
||||||
self.queue.remove(&time)
|
self.queue.remove(&time)
|
||||||
.map(|host| {
|
.map(|host| Ok(host))
|
||||||
self.instances.get_mut(&host)
|
|
||||||
.map(|instance| instance.last_fetch = Some(now));
|
|
||||||
|
|
||||||
Ok(host)
|
|
||||||
})
|
|
||||||
.unwrap_or(Err(Duration::from_secs(1)))
|
.unwrap_or(Err(Duration::from_secs(1)))
|
||||||
.map(|host| {
|
.map(|host| {
|
||||||
if let Some(last_fetch) = self.instances.get(&host).and_then(|i| i.last_fetch) {
|
let instance = self.instances.get_mut(&host);
|
||||||
|
if let Some(last_fetch) = instance.as_ref().and_then(|i| i.last_fetch) {
|
||||||
tracing::debug!("Fetch {} - last before {:.0?}", host, now - last_fetch);
|
tracing::debug!("Fetch {} - last before {:.0?}", host, now - last_fetch);
|
||||||
} else {
|
} else {
|
||||||
tracing::debug!("Fetch {} - NEW", host);
|
tracing::debug!("Fetch {} - NEW", host);
|
||||||
}
|
}
|
||||||
|
instance.map(|instance| instance.last_fetch = Some(now));
|
||||||
host
|
host
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user