-
Notifications
You must be signed in to change notification settings - Fork 1
[DEV-12952] Add Configurable Retry Behavior #350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
f68f18f to
3a7f846
Compare
…ait, backoff, and jitter This makes retry behavior consistent between sync and async clients, and in its default configuration will get users past network interruptions.
3a7f846 to
1f9ebc1
Compare
|
Hi @IndicoDataSolutions/pr-be-indicodata-ai folks! I rebased this PR onto main and have all the checks passing. Would appreciate a review when you have a chance. This functionality will be super useful for ProServe and customers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this is an urgent thing, this can probably wait, but on the platform side we've been converging on this library, which might be worth considering here instead of shipping our own? it has fancy timing, logging, and backoff stuff we could probably expose if we wanted for better script integrations
|
Hello again! Sorry, just now getting back to this. I don't have strong opinions regarding the retry implementation--whether we ship our own or use a library like Tenacity. I used the retry implementation from the toolkit since it's a known quantity, and shipping our own was already being done for AsyncIndicoClient. Do I need to swap out the implementation or make any other changes? Or is the current implementation good enough for now? Thanks! |
indico/http/retry.py
Outdated
| """ | ||
| def retry_decorator( | ||
| decorated: "Callable[ArgumentsType, InnerReturnType]", | ||
| ) -> "Callable[ArgumentsType, Awaitable[InnerReturnType]] | Callable[ArgumentsType, InnerReturnType]": # noqa: E501 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shouldn't need both inner and outer return type here i don't think? both the wrapper and the fn should be typed to return the same thing (since they do). that would probably alleviate the any typing problem too
also | isn't valid for <3.10. has to be Union[]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good catch! Those two return types are the same in this version.
It's valid on 3.9 when string escaped, like the other types that are only imported when type checking. I've run it and type checked it with mypy --strict on 3.9 without issue.
|
@IndicoDataSolutions/pr-be-indicodata-ai it looks like one of you will have to approve and/or merge? |
Summary
This PR implements configurable, best-practices retry behavior for both
IndicoClientandAsyncIndicoClientwith consistent socket connect and read timeouts. This replaces the existing retry behavior that's only present on the async client and isn't configurable.IndicoConfighas new options to control retry behavior, with reasonable defaults:Type of change
Checklist: