retry

Contents

retry#

@fitrequest.decorators.retry.retry(max_retries: int, on_status: str) Callable[source]#

A decorator to simplify adding retry logic to functions using Tenacity.

Args:

  • max_retries (int): Maximum number of retry attempts.

  • on_status (str): HTTP status code range triggering retries, in RangeSet syntax.

    See: RangeSet documentation

The decorator uses the wait_exponential_jitter strategy for retries, which combines exponential backoff and jitter for efficient retry timing. See: tenacity documentation

Example:

@retry(max_retries: int = 10, on_status = '503,507,512-600')
def get_item(item_id:int) -> dict:
    ...