-
Notifications
You must be signed in to change notification settings - Fork 478
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
Add context in state component #1708
Conversation
f7aaf9b
to
37d4a32
Compare
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.
Please address linter failures. You may want to run the linter locally to speed up addressing linter issues.
sure,can we merge #1685 first? |
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 this is a great contribution, using contexts greatly increases the reliability of code.
My concern is that I see that in many, if not most, components the context is passed but not actually used. If your method accepts a context, it's sort of expected that it will rely on it (ie. if the context is canceled, the method should return).
yes, it depends on third-party implements, if the SDK doesn't accept a |
Well, it just needs to be implemented in a SDK-by-SDK way. For example, for aerospike (just because it's the first one in alphabetic order), you can see a way to halt the request on a context cancellation here: aerospike/aerospike-client-go#255 (comment) The same technique could be used in other SDKs that don't implement context support at all. For AWS Dynamo DB, the methods need to be changed to add the |
1a3cc57
to
c133955
Compare
now if the third-party SDK has used |
Note that some SDKs have context support but the method is named different. For example, for AWS Dynamo DB, you have to add Also please see my comment in the code. In tests (files ending in |
@pigletfly please fix the failing tests. |
ping @pigletfly |
04d1b98
to
3f9c726
Compare
b241596
to
73e3066
Compare
The left failing tests are caused by the intermediate state.After this PR is merged, I will create a separate PR in dapr/dapr as well. @yaron2 @berndverst |
@pigletfly can you please address my review's comments too? |
@pigletfly with "address" I am asking that you please fix the issues, not just "resolve" the comments :)
|
ping @pigletfly |
should we send PR to corresponding sdk repo?Take aerospike for an example, components-contrib/state/aerospike/aerospike.go Lines 165 to 180 in 1af102f
ctx in Get method, but aspike.client.Get doesn't accept ctx. @ItalyPaleAle
|
Signed-off-by: pigletfly <[email protected]>
@pigletfly just try your best to use ctx where available, and maybe we can fix upstream components in subsequent changes. To avoid breaking tests, can you please add temporary methods that keep the old signature? You added:
Maybe can name this and then we also should add
This way we can avoid breaking certification tests. Please do something like this for every state store component where you added context. Eventually we can then remove the old method and make the new method the default. The best recommendation will be that we rename all methods to This is the only way to avoid introducing test failures - which we do not want to do anymore. |
Good idea !!! |
@pigletfly could you give this a try after we complete the 1.8 release? At this point we won't include it in this release. |
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
This pull request has been automatically closed because it has not had activity in the last 37 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Codecov Report
@@ Coverage Diff @@
## master #1708 +/- ##
==========================================
- Coverage 36.59% 36.59% -0.01%
==========================================
Files 177 177
Lines 16222 16217 -5
==========================================
- Hits 5937 5934 -3
+ Misses 9617 9615 -2
Partials 668 668
Continue to review full report at Codecov.
|
@pigletfly do you have time to work on this? Please update the various function to accept a context parameter. Then also create another function with the old signature so you don't break certification tests. Example: Then also add a new function with the old signature which calls the new function with context but passes in
|
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
This pull request has been automatically closed because it has not had activity in the last 37 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Signed-off-by: pigletfly [email protected]
Description
add context in state interface:
Issue reference
dapr/dapr#2716
#1601
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #[issue number]
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: