from app.utils.logger import get_logger import time stream_manager = {} logger = get_logger(__name__) def reset_stream_time(stream_id: str) -> bool: if stream_id in stream_manager: new_time = int(time.time() * 1000) logger.info(f"Stream {stream_id} reset time to {new_time}") stream_manager[stream_id]["create_time"] = new_time return True return False def stop_stream(stream_id: str): if stream_id in stream_manager: process = stream_manager[stream_id]["process"] process.terminate() process.wait() # 确保进程已经完全终止 logger.info(f"Stream {stream_id} stopped.") del stream_manager[stream_id]