Skip to content
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

feat: Add CancellationToken support for RunBuild.Exec #10185

Merged
merged 1 commit into from
Sep 14, 2024

Conversation

filzrev
Copy link
Contributor

@filzrev filzrev commented Sep 4, 2024

This PR add CancellationToken support toRunBuild.Exec method.
It's expected to be used by docfx watch command.

What's Changed in this PR

  • Add CancellationToken parameter to methods and use token on operations that take times.

    • for/foreach operations
    • Parallel.ForEach operations
    • AsParallel() operations
  • DocumentBuildContext.cs

    • Add CancellationToken property.
    • Change some constructor's access modifiers from public to internal/private that used by tests.
  • DocumentExceptionExtensions.cs

    • Add logics to handle AggregateException on cancellation.

Breaking Changes

This PR change some public method signatures.
The user who using Docfx.Plugins package need to update versions.

Test
Manually run cancellation tests with various delay patterns.
And confirmed operation is canceled with OperationCanceledException based exception (including TaskCanceledException)

Copy link
Contributor

@yufeih yufeih left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @filzrev !

@yufeih yufeih merged commit d4cdc17 into dotnet:main Sep 14, 2024
7 checks passed
@yufeih yufeih added the new-feature Makes the pull request to appear in "New Features" section of the next release note label Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature Makes the pull request to appear in "New Features" section of the next release note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants