Skip to content

Commit

Permalink
chore(deps): Bump backoff from 1.11.1 to 2.1.2 (#990)
Browse files Browse the repository at this point in the history
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Edgar Ramírez Mondragón <[email protected]>
  • Loading branch information
dependabot[bot] and edgarrmondragon authored Sep 23, 2022
1 parent 861dfc3 commit 3e819dd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
10 changes: 5 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ license = "Apache 2.0"

[tool.poetry.dependencies]
python = "<3.11,>=3.7.1"
backoff = ">=1.8.0,<2.0"
backoff = ">=2.0.0,<3.0"
pendulum = "^2.1.0"
click = "~=8.0"
fs = "^2.4.16"
Expand Down
19 changes: 8 additions & 11 deletions singer_sdk/streams/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import copy
import logging
from datetime import datetime
from typing import Any, Callable, Generator, Generic, Iterable, TypeVar, Union
from typing import TYPE_CHECKING, Any, Callable, Generator, Generic, Iterable, TypeVar
from urllib.parse import urlparse
from warnings import warn

Expand All @@ -26,12 +26,13 @@
from singer_sdk.plugin_base import PluginBase as TapBaseClass
from singer_sdk.streams.core import Stream

if TYPE_CHECKING:
from backoff.types import Details

DEFAULT_PAGE_SIZE = 1000
DEFAULT_REQUEST_TIMEOUT = 300 # 5 minutes

_TToken = TypeVar("_TToken")
_T = TypeVar("_T")
_MaybeCallable = Union[_T, Callable[[], _T]]


class RESTStream(Stream, Generic[_TToken], metaclass=abc.ABCMeta):
Expand Down Expand Up @@ -529,7 +530,7 @@ def authenticator(self) -> APIAuthenticatorBase | None:
"""
return SimpleAuthenticator(stream=self)

def backoff_wait_generator(self) -> Callable[..., Generator[int, Any, None]]:
def backoff_wait_generator(self) -> Generator[float, None, None]:
"""The wait generator used by the backoff decorator on request failure.
See for options:
Expand All @@ -542,19 +543,15 @@ def backoff_wait_generator(self) -> Callable[..., Generator[int, Any, None]]:
"""
return backoff.expo(factor=2) # type: ignore # ignore 'Returning Any'

def backoff_max_tries(self) -> _MaybeCallable[int] | None:
def backoff_max_tries(self) -> int:
"""The number of attempts before giving up when retrying requests.
Can be an integer, a zero-argument callable that returns an integer,
or ``None`` to retry indefinitely.
Returns:
int | Callable[[], int] | None: Number of max retries, callable or
``None``.
Number of max retries.
"""
return 5

def backoff_handler(self, details: dict) -> None:
def backoff_handler(self, details: Details) -> None:
"""Adds additional behaviour prior to retry.
By default will log out backoff details, developers can override
Expand Down

0 comments on commit 3e819dd

Please sign in to comment.