Closed rmshaffer closed 4 years ago
I found a simple way to do this in a non-breaking way. Working on that now, will re-publish this with those changes. (I'll still bump the minor version, though, since I think it's a big enough feature that it's worth it.)
I found a simple way to do this in a non-breaking way. Working on that now, will re-publish this with those changes. (I'll still bump the minor version, though, since I think it's a big enough feature that it's worth it.)
The changes should be ready now. I've updated the PR description with details.
Awesome, @rmshaffer! I think that does a great job of adding cancellation functionality without breaking anything. That seems especially nice for lighter weight magic commands like lsmagic and config that probably don't need cancellation support, while still letting %simulate
and %azure.*
use the new interrupt functionality.
Thanks @cgranade for the suggestion and for reviewing the changes! I’ll merge this, do some more verification of existing consumers, and then push a new release if everything looks good.
Following up on @cgranade's suggestion in #59, this PR adds a
CancellationToken
parameter to the various cell execution methods. By doing it in this way, the interrupt message is abstracted away, and consuming kernels need only to worry about theCancellationToken
.This is a non-breaking change. Existing consumers are unaffected. If consumers wish to support cancellation, there are two things they can optionally do:
CancellableMagicSymbol
rather thanMagicSymbol
, and assign the appropriate function to theExecuteCancellable
property.BaseEngine.ExecuteMundane(string, IChannel, CancellationToken)
.I've bumped the minor version number because this is a relatively significant piece of functionality that consumers may want to update their code to take advantage of.