-
Notifications
You must be signed in to change notification settings - Fork 130
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
Retry and Timeout policies for grpc and http #679
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #679 +/- ##
==========================================
- Coverage 86.37% 86.15% -0.22%
==========================================
Files 79 81 +2
Lines 4094 4282 +188
==========================================
+ Hits 3536 3689 +153
- Misses 558 593 +35 ☔ View full report in Codecov by Sentry. |
ec6da3c
to
31efcc8
Compare
The lint tests are currently failing because of a change introduced in Ruff 0.3 which is incompatible with our flake8 set-up. We should solve this issue in a separate PR. |
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
This reverts commit 8609b7f. Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
* Adds a deprecation warning for the wait() method Signed-off-by: Elena Kolevska <elena@kolevska.com> * Ruff Signed-off-by: Elena Kolevska <elena@kolevska.com> --------- Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Bernd Verst <github@bernd.dev> Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Bernd Verst <github@bernd.dev> Signed-off-by: Elena Kolevska <elena@kolevska.com>
47c60dc
to
66d1736
Compare
Is this PR ready @elena-kolevska ? I kept the ruff version at 0.2.2 for now. Lint and Ruff are passing with that. |
Signed-off-by: Elena Kolevska <elena@kolevska.com>
…into retry-timeout
It's almost ready, I just wanted to confirm a few things with you:
|
I think that's probably fine, but why wouldn't we instead add this as a decorator on the save_state method instead? Would that be possible? Right now you are not actually using a decorator but instead a method that takes another method as the argument (which is very similar to how decorators work). I just find decorators a lot cleaner. Keep in mind that you can always have the decorator intercept arbitrary **kwargs and then receive whatever properties you need to tweak retry behavior, without having to modify the method signature of the function.
How do you plan for users to be able to tweak the individual method timeouts? As optional arguments during each of the methods? That would work if you use decorators, because decorators can intercept arguments. We should not add any new parameters to methods or the constructor - everything should be optional to not cause a breaking change and we should choose either sane defaults or retain the existing behavior, but then document how this can be set. Let's also make sure using an env variable will not be the only way to control this behavior by the way. |
Yeah, decorators were my first try, and I need to go back and remember why we decided it wasn't the best option. I'll get back to you on it. |
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
I remembered why we're not using decorators: when we retry we would have to call again the whole function that prepares the request, instead of just the call, so it's better to keep the code more performant and use a single function. I also went ahead and updated all the calls and marked the PR as ready to review 🙏 |
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Description
This PR adds the possibility for users to configure Retry and Timeout policies for both grpc and http based clients.
The retry is configurable through the
DAPR_API_MAX_RETRIES
environment variable and is picked up automatically for both the grpc and http client, not requiring any code changes.I left the possibility for a more fine-grained control over the retry mechanism (the client can receive a RetryPolicy object), but I'm not sure if that's something people would need. Let's discuss it.
Issue reference
#676
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: