mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-18 17:16:26 +00:00
Add end-to-end catch-up support for XC clients and native apps: provider proxy with failover and per-viewer session pooling, REST session minting for tokenless playback URLs, catch-up admin stats, combined connection stats, and Stats UI with dedicated cards plus websocket updates. Includes Redis namespace consolidation under timeshift:* (dropping legacy timeshift_ id prefixes), dedicated catch-up stop by session_id, and cleaner channel/client metadata split for stats keys. Closes #133
37 lines
864 B
Python
37 lines
864 B
Python
from celery import shared_task
|
|
import json
|
|
import logging
|
|
import gc
|
|
from core.utils import RedisClient
|
|
from apps.proxy.live_proxy.channel_status import build_live_channel_stats_data
|
|
from core.utils import send_websocket_update
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
# Store the last known value to compare with new data
|
|
last_known_data = {}
|
|
|
|
@shared_task
|
|
def fetch_channel_stats():
|
|
redis_client = RedisClient.get_client()
|
|
|
|
try:
|
|
live_stats = build_live_channel_stats_data(redis_client)
|
|
except Exception as e:
|
|
logger.error(f"Error in channel_status: {e}", exc_info=True)
|
|
return
|
|
|
|
send_websocket_update(
|
|
"updates",
|
|
"update",
|
|
{
|
|
"success": True,
|
|
"type": "channel_stats",
|
|
"stats": json.dumps(live_stats),
|
|
},
|
|
collect_garbage=True
|
|
)
|
|
|
|
gc.collect()
|
|
|
|
|