diff --git a/src/api.rs b/src/api.rs index 2afad21..a73d6ef 100644 --- a/src/api.rs +++ b/src/api.rs @@ -187,7 +187,7 @@ impl API { } last_time = now; - if awaiting <= config.throttle && timer < (interval * (config.throttle as u128 + 2)) + if awaiting <= config.throttle && timer < (interval * (config.throttle as u128 - 2)) { if locations.len() > idx { let location = locations[idx].clone(); @@ -231,23 +231,6 @@ impl API { receiver } - fn add_error_back( - location: String, - rec: &Result, ErrorModel>, GenericError>, - locations: &mut Vec, - ) -> bool { - if let Ok(inner) = rec { - if let Err(_) = inner { - locations.push(location); - true - } else { - false - } - } else { - false - } - } - pub fn get_between( list: &Vec, from: Option, @@ -288,6 +271,23 @@ impl API { timestamped } + fn add_error_back( + location: String, + rec: &Result, ErrorModel>, GenericError>, + locations: &mut Vec, + ) -> bool { + if let Ok(inner) = rec { + if let Err(_) = inner { + locations.push(location); + true + } else { + false + } + } else { + false + } + } + fn request(&mut self, url: String) -> Result { let response = minreq::get(url) .with_header("content-type", "application/json")