This commit is contained in:
2026-03-23 14:42:36 -03:00
parent 71fd0510de
commit 5ed876d694
17 changed files with 767 additions and 137 deletions

View File

@@ -31,11 +31,12 @@ ALL_EVENT_TYPES = [
TERMINAL_EVENTS = [EVENT_JOB_COMPLETE]
def push_detect_event(job_id: str, event_type: str, data: BaseModel) -> None:
"""Push a typed detection event to Redis."""
def push_detect_event(job_id: str, event_type: str, data: BaseModel | dict) -> None:
"""Push a detection event to Redis. Accepts Pydantic models or plain dicts."""
payload = data.model_dump(mode="json") if isinstance(data, BaseModel) else data
push_event(
job_id=job_id,
event_type=event_type,
data=data.model_dump(mode="json"),
data=payload,
prefix=DETECT_EVENTS_PREFIX,
)