Handle cancellation token if function is invoked before cancellation token #2546
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue describing the changes in this PR
resolves #2415
We had a design discussion about this issue and came to the conclusion that we will not use the cancellation token in the pipeline and instead invoke
CancellationToken.None
. That way the customer can still have their function be invoked and handle the cancellation token as they want within their code.To test this out I did the following from guidance from Lilian:
use this sample for the worker app: sample
Updated the tsc here to cancel the token after 5 seconds.
Invoked the HttpTriggerWithCancellation function, set a breakpoint after the token was cancelled, resumed function execution, and saw that a
TaskCancelledException
was invoked when the pipeline's cancellation token was passed in. With my changes, I saw that I was able to modify the function to handle the cancellation token as I wish.Pull request checklist
release_notes.md
Additional information
Additional PR information