From cf96287c90a32120ad22aa7a17973ddae96a627a Mon Sep 17 00:00:00 2001 From: None Date: Tue, 10 Feb 2026 19:06:51 -0600 Subject: [PATCH] Add guard to remove_connection() - multi_worker_connection_manager.py: Add missing count > 0 guard to multi-worker remove_connection() This method doesn't appear to be called anywhere but added the guard in case it is put back into service --- apps/proxy/vod_proxy/multi_worker_connection_manager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/proxy/vod_proxy/multi_worker_connection_manager.py b/apps/proxy/vod_proxy/multi_worker_connection_manager.py index 58d6bd04..63eeae00 100644 --- a/apps/proxy/vod_proxy/multi_worker_connection_manager.py +++ b/apps/proxy/vod_proxy/multi_worker_connection_manager.py @@ -1263,12 +1263,14 @@ class MultiWorkerVODConnectionManager: profile_id = connection_data.get('m3u_profile_id') if profile_id: profile_connections_key = f"profile_connections:{profile_id}" + current_count = int(self.redis_client.get(profile_connections_key) or 0) # Use pipeline for atomic operations pipe = self.redis_client.pipeline() pipe.delete(connection_key) pipe.srem(content_connections_key, client_id) - pipe.decr(profile_connections_key) + if current_count > 0: + pipe.decr(profile_connections_key) pipe.execute() logger.info(f"Removed Redis-backed connection: {client_id}")