fix(lab): stream synchronized replay fragments

This commit is contained in:
DCCONSTRUCTIONS
2026-08-23 23:36:04 +03:00
parent a55ef475d9
commit a7caed70c1
9 changed files with 443 additions and 34 deletions
+16 -2
View File
@@ -1159,6 +1159,7 @@ def build_session_router(
session_id: str,
artifact_id: str,
epoch_ordinal: int,
generation: Annotated[str | None, Query(min_length=64, max_length=64)] = None,
if_match: Annotated[str | None, Header(alias="If-Match")] = None,
range_header: Annotated[str | None, Header(alias="Range")] = None,
) -> Response:
@@ -1172,7 +1173,13 @@ def build_session_router(
artifact_id,
)
expected_sha256 = _recorded_media_init_sha256(manifest, epoch_ordinal)
_require_matching_digest(f'"sha256:{expected_sha256}"', if_match)
if generation is None:
_require_matching_digest(f'"sha256:{expected_sha256}"', if_match)
elif SAFE_SHA256.fullmatch(generation) is None or generation != manifest.generation_sha256:
raise HTTPException(
status_code=412,
detail="Поколение записанного видео было заменено.",
)
try:
media_file = recorded_media_inspector.get_init(manifest, epoch_ordinal)
except SessionIntegrityError as exc:
@@ -1188,6 +1195,7 @@ def build_session_router(
artifact_id: str,
epoch_ordinal: int,
segment_sequence: int,
generation: Annotated[str | None, Query(min_length=64, max_length=64)] = None,
if_match: Annotated[str | None, Header(alias="If-Match")] = None,
range_header: Annotated[str | None, Header(alias="Range")] = None,
) -> Response:
@@ -1205,7 +1213,13 @@ def build_session_router(
epoch_ordinal,
segment_sequence,
)
_require_matching_digest(f'"sha256:{expected_sha256}"', if_match)
if generation is None:
_require_matching_digest(f'"sha256:{expected_sha256}"', if_match)
elif SAFE_SHA256.fullmatch(generation) is None or generation != manifest.generation_sha256:
raise HTTPException(
status_code=412,
detail="Поколение записанного видео было заменено.",
)
try:
media_file = recorded_media_inspector.get_segment(
manifest,