Skip to content

Commit

Permalink
Explain how @Retry takes precedence over handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
prkumar committed Mar 16, 2019
1 parent c494696 commit db502bc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/source/user/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,15 @@ Finally, like other Uplink decorators, you can decorate a :class:`Consumer`
subclass with :class:`@retry <uplink.retry>` to :ref:`add retry support to all
methods of that class <decorate_consumer>`.
.. note::
Response and error handlers (see :ref:`here <custom response
handler>`) are invoked after the retry condition breaks or after all
retry attempts are exhausted, whatever comes first. These callbacks
will receive the first response/exception that triggers the retry's
``stop`` condition or doesn't match its ``when`` filter.
Client-Side Rate Limiting
=========================
Expand Down
15 changes: 15 additions & 0 deletions uplink/retry/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@ class retry(decorators.MethodAnnotation):
which should benefit performance with remote services under high
contention.
.. note::
Response and error handlers (see :ref:`here <custom response
handler>`) are invoked after the retry condition breaks or all
retry attempts are exhausted, whatever comes first. These
handlers will receive the first response/exception that triggers
the retry's ``stop`` condition or doesn't match its ``when``
filter.
In other words, responses or exceptions that match
the retry condition (e.g., retry when status code is 5xx) are
not subject to response or error handlers as long as the request
doesn't break the retry's stop condition (e.g., stop retrying
after 5 attempts).
Args:
when (optional): A predicate that determines when a retry
should be attempted.
Expand Down

0 comments on commit db502bc

Please sign in to comment.