тест 9
This commit is contained in:
@@ -5,7 +5,7 @@ from datetime import date
|
||||
from time import perf_counter
|
||||
from typing import Any, Callable
|
||||
|
||||
from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException, Query, Request
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query, Request
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from sqlalchemy import text
|
||||
|
||||
@@ -1151,7 +1151,6 @@ def create_hockey_router(
|
||||
@router.post("/sessions")
|
||||
async def open_session(
|
||||
payload: SessionPayload,
|
||||
background_tasks: BackgroundTasks,
|
||||
user: HockeyUser = Depends(auth_dependency),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
@@ -1172,18 +1171,16 @@ def create_hockey_router(
|
||||
tournament_external_id=str(result.get("tournament_external_id") or ""),
|
||||
device_id=vmix_device_id,
|
||||
operator_session_token=str(result.get("token") or ""),
|
||||
# BUILD109: selecting a match must not wait for a full
|
||||
# Mapping push to vMix. The Agent receives match.assign
|
||||
# immediately; Mapping starts only after the HTTP response.
|
||||
# BUILD111: session opening sends only match.assign. Mapping
|
||||
# is applied after the selected match roster/details are in
|
||||
# the database, otherwise vMix can receive stale match data.
|
||||
wait_for_mapping=False,
|
||||
)
|
||||
assignment = result.get("agent_assignment") or {}
|
||||
if assignment.get("delivered") and assignment.get("device_id"):
|
||||
background_tasks.add_task(
|
||||
agent_hub.apply_mapping_to_device,
|
||||
str(assignment.get("device_id")),
|
||||
reason="match_assigned",
|
||||
)
|
||||
result["agent_status"] = (
|
||||
"delivered" if assignment.get("delivered")
|
||||
else ("offline" if assignment.get("device_id") else "unassigned")
|
||||
)
|
||||
except Exception as agent_error:
|
||||
# The match/session must remain usable even when a browser
|
||||
# carries a stale Agent id from another WFL account.
|
||||
|
||||
Reference in New Issue
Block a user