adp.core.retry.retry_call
- adp.core.retry.retry_call(f: ~typing.Callable[[...], ~typing.Any], fargs: tuple[~typing.Any, ...] | list[~typing.Any] | None = None, fkwargs: dict[str, ~typing.Any] | None = None, exceptions: type[Exception] | ~typing.Tuple[type[Exception], ...] = <class 'Exception'>, tries: int = -1, delay: int = 0, max_delay: int | None = None, backoff: int = 1, jitter: float | ~typing.Tuple[float, float] = 0)
Calls a function and re-executes it if it failed.
- Parameters:
f – the function to execute.
fargs – the positional arguments of the function to execute.
fkwargs – the named arguments of the function to execute.
exceptions – an exception or a tuple of exceptions to catch. default: Exception.
tries – the maximum number of attempts. default: -1 (infinite).
delay – initial delay between attempts. default: 0.
max_delay – the maximum value of delay. default: None (no limit).
backoff – multiplier applied to delay between attempts. default: 1 (no backoff).
jitter – extra seconds added to delay between attempts. default: 0. fixed if a number, random if a range tuple (min, max)
- Returns:
the result of the f function.