From 63a6f50a8b5ad6bb984282335c1481ae3cd2fe83 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Sun, 16 Mar 2025 16:51:43 +0100 Subject: [PATCH] fix: always skip failed clients --- src/client/player.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/client/player.rs b/src/client/player.rs index a291eec..9a076a9 100644 --- a/src/client/player.rs +++ b/src/client/player.rs @@ -1,6 +1,6 @@ use std::{ borrow::Cow, - collections::{BTreeMap, HashMap}, + collections::{BTreeMap, HashMap, HashSet}, fmt::Debug, }; @@ -106,6 +106,7 @@ impl RustyPipeQuery { let mut last_e = None; let mut query = Cow::Borrowed(self); let mut clients_iter = clients.iter().peekable(); + let mut failed_clients = HashSet::new(); while let Some(client) = clients_iter.next() { if query.opts.auth == Some(true) && !self.auth_enabled(*client) { @@ -115,6 +116,9 @@ impl RustyPipeQuery { } continue; } + if failed_clients.contains(client) { + continue; + } let res = query.player_from_client(video_id, *client).await; match res { @@ -130,6 +134,7 @@ impl RustyPipeQuery { tracing::warn!("error fetching player with {client:?} client: {e}; retrying with {next_client:?} client"); } last_e = Some(Error::Extraction(e)); + failed_clients.insert(*client); } Err(e) => return Err(e), }