RetryPolicy.backoff
Calculate the randomized delay the retry policy would use for a particular attempt. The method returns a delay without sleeping.
Signature
RetryPolicy.backoff(self, attempt: int, rng: random.Random) -> floatParameters
attempt- Zero-based retry number. The first retry uses zero.
rng- Random number generator. Supply a seeded generator for a repeatable test.
Return value
A number of seconds sampled uniformly between zero and the smaller of max_backoff and base_backoff multiplied by 2 to the power of attempt.
Errors
- RetryPolicy raises ValueError on construction if max_retries is outside 0 to 10. backoff makes no API request.
Python example
import random
from aeo_sdk import RetryPolicy
policy = RetryPolicy(base_backoff=0.5, max_backoff=8.0)
print(policy.backoff(attempt=0, rng=random.Random(7)))See Python client setup for the environment variables, response properties and retry settings.