Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions internal/strategy/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@ func (s *Strategy) serveReadyRepo(w http.ResponseWriter, r *http.Request, repo *
s.forwardToUpstream(w, r, host, pathValue)
return nil
}
s.maybeBackgroundFetch(repo)

// Buffer the request body so it can be replayed if serveFromBackend
// signals a fallback to upstream (e.g. on "not our ref").
Expand Down Expand Up @@ -708,13 +707,6 @@ func (s *Strategy) tryRestoreSnapshot(ctx context.Context, repo *gitclone.Reposi
return nil
}

func (s *Strategy) maybeBackgroundFetch(repo *gitclone.Repository) {
if !repo.NeedsFetch(s.cloneManager.Config().FetchInterval) {
return
}
s.submitFetch(repo)
}

// submitFetch schedules a fetch unconditionally. Use this when ls-remote has
// already confirmed the mirror is behind upstream.
func (s *Strategy) submitFetch(repo *gitclone.Repository) {
Expand Down
4 changes: 3 additions & 1 deletion internal/strategy/git/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ func (s *Strategy) generateAndUploadMirrorSnapshot(ctx context.Context, repo *gi

func (s *Strategy) scheduleSnapshotJobs(repo *gitclone.Repository) {
s.scheduler.SubmitPeriodicJob(repo.UpstreamURL(), "snapshot-periodic", s.config.SnapshotInterval, func(ctx context.Context) error {
if err := s.doFetch(ctx, repo); err != nil {
logging.FromContext(ctx).WarnContext(ctx, "Pre-snapshot fetch failed", "upstream", repo.UpstreamURL(), "error", err)
}
return s.generateAndUploadSnapshot(ctx, repo)
Comment thread
alecthomas marked this conversation as resolved.
})
s.scheduler.SubmitPeriodicJob(repo.UpstreamURL(), "lfs-snapshot-periodic", s.config.SnapshotInterval, func(ctx context.Context) error {
Expand Down Expand Up @@ -307,7 +310,6 @@ func (s *Strategy) handleSnapshotRequest(w http.ResponseWriter, r *http.Request,
http.Error(w, "Repository unavailable", http.StatusServiceUnavailable)
return
}
s.maybeBackgroundFetch(repo)

// Forward the full conditional/range set: the cache resolves If-Match /
// If-None-Match before Range, so 304/412 already take precedence over a
Expand Down