fix: always skip failed clients
This commit is contained in:
parent
8342caeb0f
commit
63a6f50a8b
1 changed files with 6 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
use std::{
|
use std::{
|
||||||
borrow::Cow,
|
borrow::Cow,
|
||||||
collections::{BTreeMap, HashMap},
|
collections::{BTreeMap, HashMap, HashSet},
|
||||||
fmt::Debug,
|
fmt::Debug,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -106,6 +106,7 @@ impl RustyPipeQuery {
|
||||||
let mut last_e = None;
|
let mut last_e = None;
|
||||||
let mut query = Cow::Borrowed(self);
|
let mut query = Cow::Borrowed(self);
|
||||||
let mut clients_iter = clients.iter().peekable();
|
let mut clients_iter = clients.iter().peekable();
|
||||||
|
let mut failed_clients = HashSet::new();
|
||||||
|
|
||||||
while let Some(client) = clients_iter.next() {
|
while let Some(client) = clients_iter.next() {
|
||||||
if query.opts.auth == Some(true) && !self.auth_enabled(*client) {
|
if query.opts.auth == Some(true) && !self.auth_enabled(*client) {
|
||||||
|
|
@ -115,6 +116,9 @@ impl RustyPipeQuery {
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if failed_clients.contains(client) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
let res = query.player_from_client(video_id, *client).await;
|
let res = query.player_from_client(video_id, *client).await;
|
||||||
match res {
|
match res {
|
||||||
|
|
@ -130,6 +134,7 @@ impl RustyPipeQuery {
|
||||||
tracing::warn!("error fetching player with {client:?} client: {e}; retrying with {next_client:?} client");
|
tracing::warn!("error fetching player with {client:?} client: {e}; retrying with {next_client:?} client");
|
||||||
}
|
}
|
||||||
last_e = Some(Error::Extraction(e));
|
last_e = Some(Error::Extraction(e));
|
||||||
|
failed_clients.insert(*client);
|
||||||
}
|
}
|
||||||
Err(e) => return Err(e),
|
Err(e) => return Err(e),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in a new issue