From b6cde2fec885a5cc13f04197142b887638670d96 Mon Sep 17 00:00:00 2001 From: SergeantPanda Date: Tue, 17 Jun 2025 16:21:10 -0500 Subject: [PATCH] Only update redis if stream switch was successful. --- apps/proxy/ts_proxy/stream_manager.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/proxy/ts_proxy/stream_manager.py b/apps/proxy/ts_proxy/stream_manager.py index 9bd08485..19141924 100644 --- a/apps/proxy/ts_proxy/stream_manager.py +++ b/apps/proxy/ts_proxy/stream_manager.py @@ -1335,6 +1335,12 @@ class StreamManager: logger.info(f"Switching from URL {self.url} to {new_url} for channel {self.channel_id}") + # IMPORTANT: Just update the URL, don't stop the channel or release resources + switch_result = self.update_url(new_url, stream_id, profile_id) + if not switch_result: + logger.error(f"Failed to update URL for stream ID {stream_id}") + return False + # Update stream ID tracking self.current_stream_id = stream_id @@ -1358,12 +1364,6 @@ class StreamManager: # Log the switch logger.info(f"Stream metadata updated for channel {self.channel_id} to stream ID {stream_id} with M3U profile {profile_id}") - # IMPORTANT: Just update the URL, don't stop the channel or release resources - switch_result = self.update_url(new_url, stream_id, profile_id) - if not switch_result: - logger.error(f"Failed to update URL for stream ID {stream_id}") - return False - logger.info(f"Successfully switched to stream ID {stream_id} with URL {new_url}") return True