Skip to content

Commit

Permalink
We can use MathJAX now!
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Jul 4, 2023
1 parent d2d9573 commit a80706a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/stamina/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,18 +217,20 @@ def retry(
wait_jitter: float | dt.timedelta = 1.0,
wait_exp_base: float = 2.0,
) -> Callable[[Callable[P, T]], Callable[P, T]]:
"""
r"""
Retry if one of configured exceptions are raised.
The backoff delays between retries grow exponentially plus a random jitter.
The backoff for retry attempt number *attempt* is computed as::
The backoff for retry attempt number *attempt* is computed as:
.. math::
wait_initial * wait_exp_base ** (attempt - 1) + random(0, wait_jitter)
wait\_initial * wait\_exp\_base^{attempt - 1} + random(0, wait\_jitter)
Since ``x**0`` is always 1, the first backoff is within the interval
``[wait_initial,wait_initial+wait_jitter]``. Thus, with default values
between 0.1 and 1.1 seconds.
Since :math:`x^0` is always 1, the first backoff is within the interval
:math:`[wait\_initial,wait\_initial+wait\_jitter]`. Thus, with default
values between 0.1 and 1.1 seconds.
If all retries fail, the *last* exception is let through.
Expand Down

0 comments on commit a80706a

Please sign in to comment.