make some neatness changes

This commit is contained in:
Sofia 2020-08-24 20:37:36 +03:00
parent 8187f1e184
commit c3ece41d81
2 changed files with 17 additions and 23 deletions

View File

@ -209,9 +209,7 @@ impl API {
} else {
while awaiting > 0 {
if let Ok((loc, rec)) = i_receiver.try_recv() {
if API::add_error_back(loc, &rec, &mut locations) {
println!("Sent back to queue");
}
API::add_error_back(loc, &rec, &mut locations);
awaiting -= 1;
sender.send(rec).ok();
}
@ -222,9 +220,7 @@ impl API {
}
} else {
if let Ok((loc, rec)) = i_receiver.try_recv() {
if API::add_error_back(loc, &rec, &mut locations) {
println!("Sent back to queue");
}
API::add_error_back(loc, &rec, &mut locations);
awaiting -= 1;
sender.send(rec).ok();
}

View File

@ -118,10 +118,9 @@ fn run(
loop {
match receiver.try_recv() {
Ok(res) => match res {
Ok(loc) => {
if loc.is_ok() {
Ok(loc) => match loc {
Ok(mut loc) => {
counter += 1;
}
let remaining = exp_time(&api, states.len() as u64 - counter as u64);
print!(
"Done: {:<5.2}% Remaining: {:<5.2} seconds\r",
@ -129,14 +128,13 @@ fn run(
remaining.as_secs_f32()
);
std::io::stdout().lock().flush().ok();
match loc {
Ok(mut loc) => locations.append(&mut loc),
locations.append(&mut loc);
}
Err(e) => eprintln!(
"Error fetching location data: {}",
e.message.unwrap_or(String::new())
),
}
}
},
Err(e) => eprintln!("{}", e),
},
Err(e) => {