Skip to content

LocalScheduledJobManager: avoid overlapping calls to PeriodicTimer.WaitForNextTickAsync, handle exceptions during shutdown.#9761

Merged
ReubenBond merged 1 commit intodotnet:mainfrom
ReubenBond:fix/job-shard-manager-polling
Nov 10, 2025
Merged

LocalScheduledJobManager: avoid overlapping calls to PeriodicTimer.WaitForNextTickAsync, handle exceptions during shutdown.#9761
ReubenBond merged 1 commit intodotnet:mainfrom
ReubenBond:fix/job-shard-manager-polling

Conversation

@ReubenBond
Copy link
Member

@ReubenBond ReubenBond commented Nov 10, 2025

Overlapping calls to PeriodicTimer.WaitForNextTickAsync are invalid, so the task needs to be captured and waited on before a subsequent call is made.

This also modifies behavior to suppress (largely expected) exceptions during shutdown and inserts a wait after an error occurs.

Microsoft Reviewers: Open in CodeFlow

…itForNextTickAsync, handle exceptions during shutdown.
Copilot AI review requested due to automatic review settings November 10, 2025 20:47
Copy link
Contributor

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 fixes concurrency issues with PeriodicTimer usage and improves exception handling during shutdown in the LocalScheduledJobManager.

  • Prevents overlapping calls to PeriodicTimer.WaitForNextTickAsync by capturing and checking task completion state
  • Adds exception suppression during shutdown for expected OperationCanceledExceptions
  • Introduces error recovery delay after exceptions in the periodic check loop

@ReubenBond ReubenBond changed the title ;LocalScheduledJobManager: avoid overlapping calls to PeriodicTimer.WaitForNextTickAsync, handle exceptions during shutdown. LocalScheduledJobManager: avoid overlapping calls to PeriodicTimer.WaitForNextTickAsync, handle exceptions during shutdown. Nov 10, 2025
@ReubenBond ReubenBond merged commit c22f2a8 into dotnet:main Nov 10, 2025
33 of 35 checks passed
@ReubenBond ReubenBond deleted the fix/job-shard-manager-polling branch November 10, 2025 21:18
@github-actions github-actions bot locked and limited conversation to collaborators Dec 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant