Repository navigation
Bound background fetches and run at most one per repository [patch] - #518
Merged
Merged
Conversation
Every stale clone started its own git fetch on the same frame, so forty clones meant forty concurrent fetches every minute, in lockstep, and a fetch slower than the interval was started again in the same repository while the first still ran. FetchScheduler now queues fetches and runs at most four at a time, refuses a second fetch for a repository that is running or queued, and each fetch time is backdated by a random jitter of up to a quarter of the interval so the repositories drift apart. Fixes #448 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW5526rrxQXBzaZBBJE
This was referenced Oct 30, 2026
…urrency # Conflicts: # ProjectDirector/ProjectDirector.cs
|
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 #448
What changed
New
FetchScheduler, in the same style asCloneTracker: the rule is pulled out so it can be tested without ImGui.DefaultMaxConcurrent). It owns no disposable, soProjectDirectordoes not have to becomeIDisposable.git fetchcan no longer race the first for ref locks, and a stale repository is queued at most once.LastFetchTimeis backdated by a random jitter of up to a quarter of the interval. Repositories fetched together then go stale at different moments instead of re-firing on the same frame every minute.LastFetchTimeand the options save are now only touched when a fetch was actually queued.FetchReporoutes both the automatic stale fetch and the manual "Fetch All" through the scheduler, so both are bounded.Tests
New
FetchSchedulerTests:[0, interval/4), varies between calls, and is zero for a disabled interval.To show the tests fail without the fix, I put the old behaviour back inside the scheduler (no bound, no in-flight check). The bound test and the same-repository test then fail. With the fix restored, all four pass, and five repeated runs gave no flakes.
The full suite: 183 passed, 1 skipped, 1 failed. The failure is
GitCliTests.CloningAnLfsRepositoryRestoresTheFileContentRatherThanThePointer, and it also fails on unmodifiedmainin this container (an LFS smudge environment issue). The whole solution builds with 0 warnings. CLAUDE.md now lists the scheduler alongside the other extracted rules.Related: #446 (the log panel). Most of the log lines that push failures out of view came from this burst.
Generated by Claude Code