mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-25 11:04:07 +00:00
Fix duplicate connection counting in redis.
This commit is contained in:
parent
4acdfa99f9
commit
6addcebaf5
2 changed files with 8 additions and 9 deletions
|
|
@ -281,6 +281,13 @@ class VODConnectionManager:
|
|||
profile_connections_key = self._get_profile_connections_key(m3u_profile.id)
|
||||
content_connections_key = self._get_content_connections_key(content_type, content_uuid)
|
||||
|
||||
# Check if connection already exists to prevent duplicate counting
|
||||
if self.redis_client.exists(connection_key):
|
||||
logger.info(f"Connection already exists for {client_id} - {content_type} {content_name}")
|
||||
# Update activity but don't increment profile counter
|
||||
self.redis_client.hset(connection_key, "last_activity", str(time.time()))
|
||||
return True
|
||||
|
||||
# Connection data
|
||||
connection_data = {
|
||||
"content_type": content_type,
|
||||
|
|
|
|||
|
|
@ -156,15 +156,7 @@ class VODStreamView(View):
|
|||
|
||||
logger.info(f"[VOD-PROFILE] Using M3U profile: {m3u_profile.id} (max_streams: {m3u_profile.max_streams}, current: {m3u_profile.current_viewers})")
|
||||
|
||||
# Track connection in Redis (simplified)
|
||||
try:
|
||||
from core.utils import RedisClient
|
||||
redis_client = RedisClient.get_client()
|
||||
profile_connections_key = f"profile_connections:{m3u_profile.id}"
|
||||
redis_client.incr(profile_connections_key)
|
||||
except Exception as e:
|
||||
logger.error(f"Error tracking connection in Redis: {e}")
|
||||
|
||||
# Connection tracking is handled by the connection manager
|
||||
# Transform URL based on profile
|
||||
final_stream_url = self._transform_url(stream_url, m3u_profile)
|
||||
logger.info(f"[VOD-URL] Final stream URL: {final_stream_url}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue