This commit is contained in:
Josh Hawkins 2026-05-03 12:25:27 -05:00
parent 2ec94bea13
commit ccbe2fda9a
2 changed files with 8 additions and 7 deletions

View File

@ -84,20 +84,20 @@ async def start_debug_replay(request: Request, body: DebugReplayStartBody):
config_publisher=request.app.config_publisher,
replay_manager=replay_manager,
)
except RuntimeError as exc:
except RuntimeError:
return JSONResponse(
content={
"success": False,
"message": str(exc),
"message": "A replay session is already active",
},
status_code=409,
)
except ValueError as exc:
logger.info("Rejected debug replay start request: %s", exc)
except ValueError:
logger.exception("Rejected debug replay start request")
return JSONResponse(
content={
"success": False,
"message": str(exc),
"message": "Invalid debug replay parameters",
},
status_code=400,
)

View File

@ -13,7 +13,7 @@ import subprocess as sp
import threading
import time
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Optional
from typing import TYPE_CHECKING, Any, Optional, cast
from peewee import ModelSelect
@ -97,7 +97,7 @@ def query_recordings(source_camera: str, start_ts: float, end_ts: float) -> Mode
Module-level so tests can patch it without instantiating a runner.
"""
return (
query = (
Recordings.select(
Recordings.path,
Recordings.start_time,
@ -111,6 +111,7 @@ def query_recordings(source_camera: str, start_ts: float, end_ts: float) -> Mode
.where(Recordings.camera == source_camera)
.order_by(Recordings.start_time.asc())
)
return cast(ModelSelect, query)
class DebugReplayJobRunner(threading.Thread):