Skip to content

Commit

Permalink
feat(retry): add Retry policy interface
Browse files Browse the repository at this point in the history
Add a new interface, `sghi.retry.Retry` and a few of its
implementations. A retry policy allows an application to handle
transient failures such as when trying to connect to a network
resource or another service. This is achieved by transparently
repeating the failed operation until it succeeds or until some
criteria are met.
  • Loading branch information
kennedykori committed Mar 30, 2024
1 parent 1dd88d5 commit f33d645
Show file tree
Hide file tree
Showing 5 changed files with 732 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
("py:class", "concurrent.futures._base.Executor"), # sphinx can't find it
("py:class", "concurrent.futures._base.Future"), # sphinx can't find it
("py:class", "sghi.dispatch._ST_contra"), # private type annotations
("py:class", "sghi.retry._RT"), # private type annotations
("py:class", "sghi.task._IT"), # private type annotations
("py:class", "sghi.task._OT"), # private type annotations
("py:class", "sghi.utils.checkers._Comparable"), # private type annotations
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ API Reference
sghi.disposable
sghi.exceptions
sghi.registry
sghi.retry
sghi.task
sghi.typing
sghi.utils
Expand Down
4 changes: 4 additions & 0 deletions src/sghi/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ def message(self) -> str | None:
or ``None`` if one wasn't given.
"""
return self._message


class SGHITransientError(SGHIError):
"""An error that indicates a temporary failure."""

0 comments on commit f33d645

Please sign in to comment.