Skip to content

Commit

Permalink
fixup! Import retry strategies from the SDK
Browse files Browse the repository at this point in the history
Signed-off-by: Sahas Subramanian <[email protected]>
  • Loading branch information
shsms committed Dec 15, 2023
1 parent 319e686 commit 95e5e6d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
from collections.abc import Iterator
from copy import deepcopy

DEFAULT_RETRY_INTERVAL = 3.0
_DEFAULT_RETRY_INTERVAL = 3.0
"""Default retry interval, in seconds."""

DEFAULT_RETRY_JITTER = 1.0
_DEFAULT_RETRY_JITTER = 1.0
"""Default retry jitter, in seconds."""


Expand Down Expand Up @@ -80,8 +80,8 @@ class LinearBackoff(RetryStrategy):

def __init__(
self,
interval: float = DEFAULT_RETRY_INTERVAL,
jitter: float = DEFAULT_RETRY_JITTER,
interval: float = _DEFAULT_RETRY_INTERVAL,
jitter: float = _DEFAULT_RETRY_JITTER,
limit: int | None = None,
) -> None:
"""Create a `LinearBackoff` instance.
Expand Down Expand Up @@ -116,7 +116,7 @@ def next_interval(self) -> float | None:
class ExponentialBackoff(RetryStrategy):
"""Provides methods for calculating the exponential interval between retries."""

DEFAULT_INTERVAL = DEFAULT_RETRY_INTERVAL
DEFAULT_INTERVAL = _DEFAULT_RETRY_INTERVAL
"""Default retry interval, in seconds."""

DEFAULT_MAX_INTERVAL = 60.0
Expand All @@ -131,7 +131,7 @@ def __init__(
initial_interval: float = DEFAULT_INTERVAL,
max_interval: float = DEFAULT_MAX_INTERVAL,
multiplier: float = DEFAULT_MULTIPLIER,
jitter: float = DEFAULT_RETRY_JITTER,
jitter: float = _DEFAULT_RETRY_JITTER,
limit: int | None = None,
) -> None:
"""Create a `ExponentialBackoff` instance.
Expand Down
8 changes: 0 additions & 8 deletions src/frequenz/client/base/retry_strategy/__init__.py

This file was deleted.

0 comments on commit 95e5e6d

Please sign in to comment.