-
Notifications
You must be signed in to change notification settings - Fork 0
Retry http errors #58
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
Conversation
|
vdel
left a comment
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.
This way of implementing the retry forces the developer to remember wrapping its function call into a retry. The problem is that when new developers come and do not do that, we will still miss the retry.
I would rather implement the retry at the low-level in make_request, forwarding retry parameters from the generic retrieve, list, etc... mixups in order to keep the possibility to locally change the retry behavior.
|
I dont' understand the problem. The retry is already located in Overriding the retry parameter from each endpoint is a feature we can probably add. Though for now I don't see a use case where it would be necessary ? This can be done in another PR if really needed one day, but I don't think it provides a lot of value to do it now. |
I was referring to places like this one: https://github.com/Deepomatic/deepomatic-client-python/pull/58/files#diff-e63474de88f64ad351a531418838acc4R126 but I didn't see that the retry condition was different from a failure. So actually this comment above is void and everything looks good for me. |
|
I think I understand what you meant. I could have merged the retry policy of the task with the http helper retry policy instead of using two different retryer, but I don't know if it really make sense to merge the network failures with the retry on "pending" tasks. I don't think it is a big deal though ? |
Let's discuss it IRL; I am not sure what we want to do, what should be avoided (double level retry?)... |
|
There is retry in case of error 5XX for example, then we use retry to poll on the task until it completes. |
| if http_retry is not None: | ||
| return http_retry.retry(functor) | ||
|
|
||
| return functor() |
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.
nit: I would move that in an else: it would then be at the same level as with the http_retry: much clearer IMO
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.
I think it is a matter of taste, I prefer when there is always a non indented return
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.
indeed; I was struggling with that and the early return: either both return in if/else, or only one return maybe?
if http_retry is not None:
functor = functools.partial(http_retry.retry, functor)
Co-Authored-By: Thomas Riccardi <thomas@deepomatic.com>
Co-Authored-By: Thomas Riccardi <thomas@deepomatic.com>
Co-Authored-By: Thomas Riccardi <thomas@deepomatic.com>
Related to #17