Skip to content

Conversation

@JamieMagee
Copy link
Member

This change refactors the timeout logic in AsyncExecution to use cancellation tokens. The changes modernize the way timeouts are handled for both asynchronous and void-returning methods, ensuring that timeouts trigger cancellation and throw a TimeoutException as expected.

@JamieMagee JamieMagee requested a review from a team as a code owner November 14, 2025 18:08
Copilot finished reviewing on behalf of JamieMagee November 14, 2025 18:12
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the timeout logic in AsyncExecution to use cancellation tokens instead of the previous Task.Wait(timeout) approach. The changes introduce linked cancellation token sources that combine caller-provided cancellation with timeout-based cancellation, and distinguish between explicit cancellation and timeouts via exception filtering.

  • Adds CancellationToken parameter with default value for better API ergonomics
  • Uses CancellationTokenSource.CreateLinkedTokenSource to chain timeout and caller cancellation
  • Implements exception filtering to convert timeout-based OperationCanceledException to TimeoutException

@JamieMagee JamieMagee requested a review from Copilot November 14, 2025 18:44
@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

❌ Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.3%. Comparing base (9e9bcc6) to head (af86d53).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...rosoft.ComponentDetection.Common/AsyncExecution.cs 90.9% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1531   +/-   ##
=====================================
  Coverage   90.3%   90.3%           
=====================================
  Files        418     418           
  Lines      35299   35301    +2     
  Branches    2188    2187    -1     
=====================================
+ Hits       31876   31879    +3     
- Misses      2980    2981    +1     
+ Partials     443     441    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot finished reviewing on behalf of JamieMagee November 14, 2025 18:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

@JamieMagee JamieMagee requested a review from Copilot November 14, 2025 21:09
Copilot finished reviewing on behalf of JamieMagee November 14, 2025 21:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

@JamieMagee JamieMagee force-pushed the users/jamagee/asyncexecution-cancellationtoken branch from aee3084 to 5464d92 Compare November 14, 2025 21:51
@JamieMagee JamieMagee enabled auto-merge (squash) November 14, 2025 21:51
@JamieMagee JamieMagee force-pushed the users/jamagee/asyncexecution-cancellationtoken branch from 5464d92 to af86d53 Compare November 14, 2025 21:56
@JamieMagee JamieMagee merged commit 4ea5d5b into main Nov 14, 2025
25 of 26 checks passed
@JamieMagee JamieMagee deleted the users/jamagee/asyncexecution-cancellationtoken branch November 14, 2025 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants