Skip to content

Commit

Permalink
fix: mark client retry backoff function as static
Browse files Browse the repository at this point in the history
Ensure the function does not receives 2 arguments (self, retries)
  • Loading branch information
jooola committed Jul 30, 2024
1 parent 3e0a85b commit 05b1b6f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions hcloud/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ class Client:
_version = __version__
__user_agent_prefix = "hcloud-python"

_retry_interval = exponential_backoff_function(
base=1.0, multiplier=2, cap=60.0, jitter=True
_retry_interval = staticmethod(
exponential_backoff_function(base=1.0, multiplier=2, cap=60.0, jitter=True)
)
_retry_max_retries = 5

Expand Down Expand Up @@ -291,7 +291,6 @@ def request( # type: ignore[no-untyped-def]
error["code"] == "rate_limit_exceeded"
and retries < self._retry_max_retries
):
# pylint: disable=too-many-function-args
time.sleep(self._retry_interval(retries))
retries += 1
continue
Expand Down

0 comments on commit 05b1b6f

Please sign in to comment.