feat: log failed player fetch attempts with player_from_clients

This commit is contained in:
ThetaDev 2025-02-06 14:04:01 +01:00
parent 594e675b39
commit 8e35358c89
No known key found for this signature in database
GPG key ID: E319D3C5148D65B6

View file

@ -104,8 +104,9 @@ impl RustyPipeQuery {
) -> Result<VideoPlayer, Error> {
let video_id = video_id.as_ref();
let mut last_e = None;
let mut clients_iter = clients.iter().peekable();
for client in clients {
while let Some(client) = clients_iter.next() {
if self.opts.auth == Some(true) && !self.auth_enabled(*client) {
// If no client has auth enabled, return NoLogin error instead of "no clients"
if last_e.is_none() {
@ -142,6 +143,9 @@ impl RustyPipeQuery {
} else if !e.switch_client() {
return Err(Error::Extraction(e));
}
if let Some(next_client) = clients_iter.peek() {
tracing::warn!("error fetching player with {client:?} client: {e}; retrying with {next_client:?} client");
}
last_e = Some(Error::Extraction(e));
}
Err(e) => return Err(e),