fix: keep polling intervals when a provider update throws - #322
Merged
Merged
Conversation
A persistent 5xx from one repository made BuildSync/RunSync.UpdateAsync throw before restarting their timers, and faulted the Task.WhenAll over the batch, which skipped ProviderRefreshTimer.Restart and pruning. The update loop then re-ran discovery and re-polled back to back. Each sync and each discovery item now runs through SyncGuard, which logs a failure instead of faulting the batch; the sync timers and the provider refresh timer restart in finally blocks. Fixes #299 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F4JLDZ8V6BpUZBB9ZnsaNt
Narrow the BuildMonitor.cs change to guarding each discovery item: once no item can fault the batch, the ProviderRefreshTimer restart after it is always reached, so the method no longer needs moving. Add a test that a failing run update neither faults its batch nor stays due. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F4JLDZ8V6BpUZBB9ZnsaNt
Moves the per-item guarding out of the static update loop into a helper that can be tested directly, and covers it with a test that a failing discovery item is logged while the rest still run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F4JLDZ8V6BpUZBB9ZnsaNt
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Fixes #299
What was wrong
MakeGitHubRequestAsyncrethrows 5xxApiExceptions. When one arrived:BuildSync.UpdateAsyncandRunSync.UpdateAsyncthrew beforeUpdateTimer.Restart(), soShouldUpdatestayed true.Task.WhenAllinBuildMonitor.UpdateAsyncfaulted, which skippedProviderRefreshTimer.Restart()andPruneOrphanedAndCompletedSyncs.OnRenderthen restarted the update loop immediately. Discovery and polling ran back to back instead of every 120 s / 300 s.Change
SyncGuard.RunAsyncruns one item of a batch and logs its exception withLog.Errorinstead of letting it fault the batch.BuildSync.UpdateAsyncandRunSync.UpdateAsyncrun their provider call throughSyncGuardand restart their timer infinally.BuildMonitor.UpdateAsync, every per-owner and per-repository discovery call is now guarded. One bad repository no longer stops discovery for the others, and theProviderRefreshTimer.Restart()after the batch always runs.Tests
SyncFailureTestsuses a fake provider whose update throwsHttpRequestException:AFailedBuildUpdateStillRestartsItsTimer: after a failed update,TimeRemainingis back at the full interval andShouldUpdateis false.AFailedBuildUpdateDoesNotStopTheOthersInTheBatch: aWhenAllover one failing build and one healthy build completes without faulting, and the healthy build is still polled.AFailedRunUpdateDoesNotStopTheOthersInTheBatch: the same check for runs. The failed run is also no longer due.Each test fails with its production change reverted and passes with it. The full suite passes, 80/80.
🤖 Generated with Claude Code
https://claude.ai/code/session_01F4JLDZ8V6BpUZBB9ZnsaNt