Skip to content

fix: use for semaphore wait in #25152

Merged
salihozkara merged 1 commit into
devfrom
fix/dynamic-bg-worker-stop-cancellation
Mar 25, 2026
Merged

fix: use for semaphore wait in #25152
salihozkara merged 1 commit into
devfrom
fix/dynamic-bg-worker-stop-cancellation

Conversation

@maliming

Copy link
Copy Markdown
Member

When the app shuts down, the ApplicationStopping token is already cancelled, causing _semaphore.WaitAsync(cancellationToken) in StopAllAsync to immediately throw a TaskCanceledException. Changed to CancellationToken.None so the cleanup always completes.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes shutdown cleanup for dynamic background workers by preventing StopAllAsync from failing early when the host’s ApplicationStopping token is already canceled.

Changes:

  • Update StopAllAsync to wait on the internal semaphore without using the caller-provided cancellation token during shutdown.

@maliming maliming added this to the 10.3-preview milestone Mar 25, 2026
@salihozkara salihozkara merged commit 3b7dd16 into dev Mar 25, 2026
8 of 9 checks passed
@salihozkara salihozkara deleted the fix/dynamic-bg-worker-stop-cancellation branch March 25, 2026 05:38
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