removed with_retry

This commit is contained in:
2026-06-24 15:29:54 +02:00
committed by appleb_m
parent 4e45c08373
commit 9319f735c2
2 changed files with 0 additions and 84 deletions
-33
View File
@@ -41,39 +41,6 @@ class FaceDetectionProgressReporter(Protocol):
def emit_progress(self, payload: dict) -> None: ...
T = TypeVar("T")
def with_retry(
func: Callable[[], T],
*,
max_attempts: int,
on: tuple[type[Exception], ...],
escalate: type[AareException] | None = None,
escalate_message: str | None = None,
escalate_critical: bool | None = None,
) -> T:
attempts = max(1, int(max_attempts))
last_error: Exception | None = None
for _ in range(attempts):
try:
return func()
except on as error:
last_error = error
if escalate is not None:
kwargs: dict[str, bool] = {}
if escalate_critical is not None:
kwargs["critical"] = escalate_critical
message = escalate_message or str(last_error)
raise escalate(message, **kwargs) from last_error
if last_error is not None:
raise last_error
raise RuntimeError("with_retry exhausted without a captured exception")
@dataclass
class DAQRuntimeState:
sample_provider: SampleProvider