fix: tolerate transient status locks and document real BOM roundtrip validation

This commit is contained in:
阿白叔 committed 2026-10-15 18:22:33 +08:00
1 parent 9b2372e389
commit 65a72c6a3a
4 files changed
+502 -1

No files matched your search

@@ -1460,12 +1460,23 @@ def _read_status_details(path: Path) -> tuple[tuple[str, str, str, str], ...]:
return tuple(entries)
def _open_status_for_read(path: Path):
deadline = time.monotonic() + 1.0
while True:
try:
return path.open('rb')
except PermissionError:
if time.monotonic() >= deadline:
raise
time.sleep(.02)
def _read_appended_status_details(
session: QuickRunBatchSession,
) -> tuple[tuple[tuple[str, str, str, str], ...], int, tuple[int, int], tuple[int, int, int, int, int]]:
path = session.handoff.status_path
try:
with path.open("rb") as handle:
with _open_status_for_read(path) as handle:
current = os.fstat(handle.fileno())
identity = _file_identity(current)
if identity != session.status_identity or current.st_size < session.status_offset: