Hey everyone, happy tuesday! Question for you - i...
# troubleshooting
s
Hey everyone, happy tuesday! Question for you - if 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 know we have some documentation, but I'm having a hard time wrapping my head around it 😅 especially the backoff.constant function, which doesn't seem to exist Thanks!
v
My first question is why, but to answer your question(s)
if 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
Copy code
def backoff_wait_generator() -> Callable[..., Generator[int, Any, None]]:
    return backoff.constant(interval=30)
def backoff_max_tries(): 
    return 2
Would do the trick
Copy code
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
Copy code
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!
s
Awesome, and this would go in your stream class? 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 parameters
v
Awesome, 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 parameters
Stingy is very normal, saying wait 30 seconds and try twice isn't normal!
s
Just wanted to be precise in my question to make sure I got the most knowledge possible 😉 I'll probably just add an additional retry and we should be fine, but I wanted to make sure I knew how to set a hard backoff if necessary also 😄