diff --git a/hunter/src/scheduler.rs b/hunter/src/scheduler.rs index c553c97..6735480 100644 --- a/hunter/src/scheduler.rs +++ b/hunter/src/scheduler.rs @@ -65,7 +65,6 @@ impl Scheduler { let instance = self.instances.get_mut(&host).unwrap(); let last_interval = instance.last_fetch.map(|last_fetch| now - last_fetch); - instance.last_fetch = Some(now); instance.error = false; let next_interval = match (new_post_ratio, mean_interval, last_interval) { @@ -94,7 +93,12 @@ impl Scheduler { if let Some(time) = self.queue.keys().next().cloned() { if time <= now { self.queue.remove(&time) - .map(|host| Ok(host)) + .map(|host| { + self.instances.get_mut(&host) + .map(|instance| instance.last_fetch = Some(now)); + + Ok(host) + }) .unwrap_or(Err(Duration::from_secs(1))) .map(|host| { if let Some(last_fetch) = self.instances.get(&host).and_then(|i| i.last_fetch) {