hunter: set last_fetch on dequeue() not reenqueue()
This commit is contained in:
parent
41df64f408
commit
2f7b9a4b23
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue