From 8bb8a0fca904ccfc3c554ac6702e88ab94d3f094 Mon Sep 17 00:00:00 2001 From: None Date: Wed, 11 Feb 2026 20:52:30 -0600 Subject: [PATCH] fix(ts-proxy): Remove redundant local import causing UnboundLocalError The local `from apps.channels.models import Channel` inside a conditional block in _handle_client_disconnect() shadowed the top-level import. When the condition was False, Python's function-level scoping caused line 462's Channel.objects.get() to raise UnboundLocalError. Channel is already imported at module level (line 11), making the local import unnecessary. Discovered when testing proxy changes --- apps/proxy/ts_proxy/stream_generator.py | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/proxy/ts_proxy/stream_generator.py b/apps/proxy/ts_proxy/stream_generator.py index 3c2a66fe..875d9d0e 100644 --- a/apps/proxy/ts_proxy/stream_generator.py +++ b/apps/proxy/ts_proxy/stream_generator.py @@ -437,7 +437,6 @@ class StreamGenerator: client_count = proxy_server.client_managers[self.channel_id].get_total_client_count() # Only the last client or owner should release the stream if client_count <= 1 and proxy_server.am_i_owner(self.channel_id): - from apps.channels.models import Channel try: # Get the channel by UUID channel = Channel.objects.get(uuid=self.channel_id)