From 93ec7f27cceff27080a61cb30540b5ecbb2fe44a Mon Sep 17 00:00:00 2001 From: ChuckBuilds <33324927+ChuckBuilds@users.noreply.github.com> Date: Fri, 23 May 2025 09:49:57 -0500 Subject: [PATCH] increase timeout to hopefully connect --- src/ytm_client.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ytm_client.py b/src/ytm_client.py index 839cbd9a..da06e4ac 100644 --- a/src/ytm_client.py +++ b/src/ytm_client.py @@ -125,8 +125,11 @@ class YTMClient: auth=auth_payload ) self._connection_event.clear() - if not self._connection_event.wait(timeout=timeout): - logging.warning(f"YTM Socket.IO connection attempt timed out after {timeout}s.") + # Use a slightly longer timeout for the event wait than the connect call itself + # to ensure the connect event has time to be processed. + event_wait_timeout = timeout + 5 # e.g., if connect timeout is 10s, wait 15s for the event + if not self._connection_event.wait(timeout=event_wait_timeout): + logging.warning(f"YTM Socket.IO connection event not received within {event_wait_timeout}s (connect timeout was {timeout}s).") self.is_connected = False # Ensure is_connected is false on timeout return False return self.is_connected # This should be true if connect event fired and no timeout