From 3cca3a22f64f8d5dd44dfa2fc7c1e6aade5acb1c Mon Sep 17 00:00:00 2001 From: dekzter Date: Tue, 4 Mar 2025 11:00:39 -0500 Subject: [PATCH] fixed lock identifier to applly only to profile and index, not channel and stream --- core/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/views.py b/core/views.py index 59d69ee0..002dda60 100644 --- a/core/views.py +++ b/core/views.py @@ -79,6 +79,7 @@ def stream_view(request, stream_id): logger.debug('Profile is not active, skipping.') continue + logger.debug(f'Profile has a max streams of {profile.max_streams}') # Acquire the persistent Redis lock, indexed by 0 through max_streams available in the profile stream_index = 0 while True: @@ -89,9 +90,10 @@ def stream_view(request, stream_id): logger.debug(f"Profile is using all available streams.") break - lock_key = f"lock:{channel.id}:{stream.id}:{profile.id}:{stream_index}" + lock_key = f"lock:{profile.id}:{stream_index}" persistent_lock = PersistentLock(redis_client, lock_key, lock_timeout=120) + logger.debug(f'Attempting to acquire lock: {lock_key}') if not persistent_lock.acquire(): logger.error(f"Could not acquire persistent lock for profile {profile.id} index {stream_index}, currently in use.") continue