-
Notifications
You must be signed in to change notification settings - Fork 152
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 ICancellationStrategy extensibility point #541
Conversation
Codecov Report
@@ Coverage Diff @@
## master #541 +/- ##
==========================================
+ Coverage 89.72% 89.86% +0.13%
==========================================
Files 53 54 +1
Lines 4420 4438 +18
==========================================
+ Hits 3966 3988 +22
+ Misses 454 450 -4
Continue to review full report at Codecov.
|
This allows specific JsonRpc instances to be configured to implement `CancellationToken` support in a totally different way. They are *not* given the freedom to mutate the the request object itself, but they may trigger and respond to any other JSON-RPC message or do something entirely out of band (e.g. creating a file and/or testing for existing of the file). As part of this change, we had to move `$/cancelRequest` handling out of its very special place in `JsonRpc.HandleRpcAsync` into a standard method handler. But that would have changed the method handler to be invoked on the user-configurable `SynchronizationContext` (which is now by default order-preserving). But this special method *shouldn't* be subject to that order-preserving `SynchronizationContext` because in fact we want these cancellation requests handled as soon as they come in so they can cancel an ongoing RPC server method that has not yet yielded. In order to support this, I modified how we record `TargetMethod` to include an optional override `SynchronizationContext`.
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.
thank you!
This is important to support strategy implementations that create a file in `CancelOutboundRequest` and must delete it when the cancellation request has completed.
@AArnott thank you! when will this be inserted to VS? |
@huguesv for FYI |
@heejaechang StreamJsonRpc insertions happen nightly. |
This allows specific JsonRpc instances to be configured to implement
CancellationToken
support in a totally different way. They are not given the freedom to mutate the the request object itself, but they may trigger and respond to any other JSON-RPC message or do something entirely out of band (e.g. creating a file and/or testing for existing of the file).As part of this change, we had to move
$/cancelRequest
handling out of its very special place inJsonRpc.HandleRpcAsync
into a standard method handler. But that would have changed the method handler to be invoked on the user-configurableSynchronizationContext
(which is now by default order-preserving). But this special method shouldn't be subject to that order-preservingSynchronizationContext
because in fact we want these cancellation requests handled as soon as they come in so they can cancel an ongoing RPC server method that has not yet yielded. In order to support this, I modified how we recordTargetMethod
to include an optional overrideSynchronizationContext
.Closes #436