hunter/scheduler: revert set last_fetch on dequeue() not reenqueue()
This commit is contained in:
parent
5f1d9862c5
commit
9df753d1b6
|
@ -65,6 +65,7 @@ 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) {
|
||||
|
@ -93,16 +94,13 @@ impl Scheduler {
|
|||
if let Some(time) = self.queue.keys().next().cloned() {
|
||||
if time <= now {
|
||||
self.queue.remove(&time)
|
||||
.map(|host| Ok(host))
|
||||
.unwrap_or(Err(Duration::from_secs(1)))
|
||||
.ok_or(Duration::from_secs(1))
|
||||
.map(|host| {
|
||||
let instance = self.instances.get_mut(&host);
|
||||
if let Some(last_fetch) = instance.as_ref().and_then(|i| i.last_fetch) {
|
||||
if let Some(last_fetch) = self.instances.get(&host).and_then(|i| i.last_fetch) {
|
||||
tracing::debug!("Fetch {} - last before {:.0?}", host, now - last_fetch);
|
||||
} else {
|
||||
tracing::debug!("Fetch {} - NEW", host);
|
||||
}
|
||||
instance.map(|instance| instance.last_fetch = Some(now));
|
||||
host
|
||||
})
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue