Replay archived stability rounds on the rungs below the project's, on the code each reviewed

This commit is contained in:
2026-10-15 20:05:29 +02:00
parent f705fa626f
commit 9fa570a0f5
4 changed files with 16 additions and 15 deletions
+11
View File
@@ -47,3 +47,14 @@ def limit_wait(limited: Limited, now: float) -> float:
if limited.resets_at is not None and limited.resets_at + PAST_RESET > now:
return limited.resets_at + PAST_RESET - now
return UNKNOWN_RESET_POLL
def first_reply(attempt: typing.Callable[[], T | Failure | Limited]) -> T | Failure | Limited:
"""The first reply that is no Failure, or the last of FAILURES_RUNNING failures: a replay's retry.
It counts failures as retried does, but neither waits between attempts nor waits out a usage limit, which ends a replay.
"""
for _ in range(FAILURES_RUNNING - 1):
if not isinstance(reply := attempt(), Failure):
return reply
return attempt()