Fix critical mistake in intervals
This commit is contained in:
parent
c3ece41d81
commit
a2a92d39eb
36
src/api.rs
36
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<Result<Vec<LocationModel>, ErrorModel>, GenericError>,
|
||||
locations: &mut Vec<String>,
|
||||
) -> bool {
|
||||
if let Ok(inner) = rec {
|
||||
if let Err(_) = inner {
|
||||
locations.push(location);
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_between<T: Timestamped + Clone>(
|
||||
list: &Vec<T>,
|
||||
from: Option<NaiveDateTime>,
|
||||
@ -288,6 +271,23 @@ impl API {
|
||||
timestamped
|
||||
}
|
||||
|
||||
fn add_error_back(
|
||||
location: String,
|
||||
rec: &Result<Result<Vec<LocationModel>, ErrorModel>, GenericError>,
|
||||
locations: &mut Vec<String>,
|
||||
) -> 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<Response, GenericError> {
|
||||
let response = minreq::get(url)
|
||||
.with_header("content-type", "application/json")
|
||||
|
Loading…
Reference in New Issue
Block a user