fix(jobs): disable default timeout for mirror sync git commands#904
Open
syf2211 wants to merge 1 commit into
Open
fix(jobs): disable default timeout for mirror sync git commands#904syf2211 wants to merge 1 commit into
syf2211 wants to merge 1 commit into
Conversation
Mirror fetch/update commands inherit git-module's 1-minute DefaultTimeout when no explicit timeout is set, which can kill large repo syncs mid-transfer after prune has already removed local refs. Apply WithTimeout(-1) to both sync commands, matching ImportRepository's clone behavior and other long-running git paths in the codebase. Fixes charmbracelet#803
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.
Summary
Mirror sync jobs now disable git-module's 1-minute default timeout for
fetch --pruneandremote update --prune, preventing large mirror repos from being left in a broken partially-synced state.Motivation
mirror-pullbuilds git commands without an explicit timeout, so git-module appliesDefaultTimeout(1 minute). For large repos, the fetch can be killed mid-transfer after--prunehas already removed local refs that no longer exist on the remote, but before new refs are fully fetched.ImportRepositoryalready usesTimeout: -1for the initial mirror clone; the periodic sync path did not.Fixes #803
Changes
.WithTimeout(-1)to mirror sync git commands inpkg/jobs/mirror.gogit/server.goandpkg/lfs/scanner.goTests
go test ./pkg/jobs/... ./git/...— passNotes
No new unit test added; timeout behavior is inherited from git-module and would be slow/flaky to exercise in CI. The change is a one-line call-site fix consistent with other long-running git operations in this repo.