-
Notifications
You must be signed in to change notification settings - Fork 232
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
Context aware SDK with timeouts #276
Conversation
UPDATE: common problem trying the 'Edit' trick |
We may need the ability to opt out of timeouts, I'm not sure, we should check in with the Azure team and see how it goes with their implementation |
What impact will this have on |
@paultyng Yes this as its coded doesn't feel just right, as every context has a timeout set even if none was configured (as I believe the timeouts all have some hardcoded 20 min duration if nothing was set?) An opt out would make sense |
Seems we might have a flaky test: |
Is there anyway now that you have been in this code a bit to remove those dead functions with panics? |
@paultyng As discussed it should be possible, but I'll address it in a follow up PR (maybe I can sneak it in at the end) |
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.
Approved provided everyone's happy on the timeouts issue, and any other review comments are addressed.
refactor codebase around Contextify() this drops the need for conditional evaluation of CRUD w/ context and treats that as the default codepath. One caveat is if a dev sets a noncontext and context func, the noncontext func is essentially ignored. I don't see the need to panic/error if both are set I think it should be obvious.
force cancellation through ctx API merge a server instanced context's cancellation with the GRPC request scoped context's cancellation
make all CustomizeDiff funcs to context aware (breaking change)
remove legacy terraform version as this SDK can never talk with Terraform < 0.12
placeholders. Made configure context aware
rearrange internal crud funcs happy path
add retroactive deprecated comment to MigrateState need to decide if the feature should be cut in v2 if this is the cause we should place the deprecated comment in the next v1 release.
update stop feature tests to have 5 second timeout this ensures any regressions are caught in tests otherwise the tests themselves deadlock when the implementation is broken. Passing tests execute near instantly.
* implement Context aware CRUD(E) functions * set context timeouts according to CRUD func * add InternalValidate check for dually set CRUD * add test cases ensuring context aware funcs are called. * add NoopContext helper * add context to shims tests * breaking change: context aware CustomizeDiff * remove schema.Provider.StopContext feature * remove schema.Provider.MetaReset func * remove legacy terraform version as this SDK can never talk with Terraform < 0.12 * use UnaryInterceptor to configure new stop context * add deprecated comments to now legacy non context identifiers * add grpc cancel and Stop messag tests, as well as reset test * add context support to ImportState * breaking change: context aware StateUpgraders * add context support to ConfigureFunc
* implement Context aware CRUD(E) functions * set context timeouts according to CRUD func * add InternalValidate check for dually set CRUD * add test cases ensuring context aware funcs are called. * add NoopContext helper * add context to shims tests * breaking change: context aware CustomizeDiff * remove schema.Provider.StopContext feature * remove schema.Provider.MetaReset func * remove legacy terraform version as this SDK can never talk with Terraform < 0.12 * use UnaryInterceptor to configure new stop context * add deprecated comments to now legacy non context identifiers * add grpc cancel and Stop messag tests, as well as reset test * add context support to ImportState * breaking change: context aware StateUpgraders * add context support to ConfigureFunc
* implement Context aware CRUD(E) functions * set context timeouts according to CRUD func * add InternalValidate check for dually set CRUD * add test cases ensuring context aware funcs are called. * add NoopContext helper * add context to shims tests * breaking change: context aware CustomizeDiff * remove schema.Provider.StopContext feature * remove schema.Provider.MetaReset func * remove legacy terraform version as this SDK can never talk with Terraform < 0.12 * use UnaryInterceptor to configure new stop context * add deprecated comments to now legacy non context identifiers * add grpc cancel and Stop messag tests, as well as reset test * add context support to ImportState * breaking change: context aware StateUpgraders * add context support to ConfigureFunc
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
This change would allow developers to switch CRUD funcs and CustomizeDiff funcs to ones that receives a
context.Context
, configured with the appropriate timeouts (in the case of CRUD). This PR makes some breaking changes to a fewschema.Resource
methods by adding thecontext.Context
as the first argument. This likely won't cause problems in the wild because aschema.Resource's
Apply/Refresh/etc
methods were not really meant to be public (they are not useful to anyone).This PR also forces cancellation through the new context API, removing the previous
StopContext
feature (this is a breaking change).This is a PR against our working
version2
branch. That branch I have taken the liberty of privatizing/internalizing and pruning dead code/code never intended for public use (cutting the internalized version for Core, and removing support for protocol 4). The PR represents the first enhancement w/ deliberate breaking change. PRs like this should go through a full review process and not just push directly to that branch.