PythiloLesson 9 of 12 · progress kept in this browser

Spend one end-to-end deadline across retries

Independent timeout values can accidentally multiply the latency of one request. An end-to-end deadline limits the whole operation, including attempts and backoff. Before admitting another attempt, reserve enough time for that attempt instead of checking only whether the sleep fits.

This planner accepts elapsed time and deterministic candidate delays. It schedules full attempts only and never sleeps. Equality at the budget boundary is accepted by contract. Production jitter, retryable error classification and idempotency are independent decisions. Retrying every error until a timer expires is not a resilience strategy.

budget=1.0
elapsed=0.4
delay=0.2
attempt=0.3
print(elapsed+delay+attempt<=budget)
Your task

Implement retry_plan(budget,attempt,delays). The initial attempt consumes attempt seconds; each listed retry consumes delay+attempt. Return admitted delays in order, stopping at the first that would exceed budget. Reject negative values.