Stéphane Burwash
04/25/2023, 2:30 PMvisch
04/25/2023, 3:15 PMif I want to set a hard backoff of 30 seconds (with 2 retries) for my tap, what would the best way be to go about it?I think
def backoff_wait_generator() -> Callable[..., Generator[int, Any, None]]:
return backoff.constant(interval=30)
def backoff_max_tries():
return 2
Would do the trick
the backoff.constant function which doesn't seem to exist
Is from the backoff
library - https://pypi.org/project/backoff/ (included as a dependency in the sdk), so
import backoff
def backoff_wait_generator() -> Callable[..., Generator[int, Any, None]]:
return backoff.constant(interval=30)
def backoff_max_tries():
return 2
Would be great if after you get this working you add it as an example to the docs!Stéphane Burwash
04/25/2023, 3:17 PMvisch
04/25/2023, 3:19 PMAwesome, and this would go in your stream class?@Stéphane Burwash yes that would work (They all inherit from the same place so you could plop it in your
client.py
that I imagine you have if you want this for all your calls)
Reason I want to look into this is we're implementing an internal API and product is quite stingy about how often I can ping it, so I need to modify the backoff to suit their parametersStingy is very normal, saying wait 30 seconds and try twice isn't normal!
Stéphane Burwash
04/25/2023, 3:25 PM