mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
pr autoreviewer fixes
This commit is contained in:
@@ -59,8 +59,14 @@ async def mixdown_tracks_pyav(
|
||||
logger: Optional logger instance
|
||||
|
||||
Raises:
|
||||
ValueError: If no valid tracks or containers can be opened
|
||||
ValueError: If offsets_seconds length doesn't match track_urls,
|
||||
no valid tracks provided, or no containers can be opened
|
||||
"""
|
||||
if offsets_seconds is not None and len(offsets_seconds) != len(track_urls):
|
||||
raise ValueError(
|
||||
f"offsets_seconds length ({len(offsets_seconds)}) must match track_urls ({len(track_urls)})"
|
||||
)
|
||||
|
||||
valid_track_urls = [url for url in track_urls if url]
|
||||
if not valid_track_urls:
|
||||
if logger:
|
||||
|
||||
@@ -16,6 +16,7 @@ import threading
|
||||
import redis.asyncio as redis
|
||||
from fastapi import WebSocket
|
||||
|
||||
from reflector.events import subscribers_shutdown
|
||||
from reflector.settings import settings
|
||||
|
||||
|
||||
@@ -125,3 +126,14 @@ def get_ws_manager() -> WebsocketManager:
|
||||
)
|
||||
_ws_manager_instance = WebsocketManager(pubsub_client=pubsub_client)
|
||||
return _ws_manager_instance
|
||||
|
||||
|
||||
async def cleanup_ws_manager(_app=None) -> None:
|
||||
"""Cleanup WebsocketManager singleton on shutdown."""
|
||||
global _ws_manager_instance
|
||||
if _ws_manager_instance is not None:
|
||||
await _ws_manager_instance.pubsub_client.disconnect()
|
||||
_ws_manager_instance = None
|
||||
|
||||
|
||||
subscribers_shutdown.append(cleanup_ws_manager)
|
||||
|
||||
Reference in New Issue
Block a user