From c513262e2c31aec0ced428d606b99329d11c62b9 Mon Sep 17 00:00:00 2001 From: Josh Friend Date: Thu, 16 Apr 2026 15:09:03 -0400 Subject: [PATCH] fix: fold LFS snapshot scheduling into scheduleSnapshotJobs scheduleLFSSnapshotJobs was missing from the writeSnapshotSpool and scheduleDeferredMirrorRestore code paths, so repos first initialized through cold-start or on-demand spool never had LFS snapshots generated. Fold the LFS periodic job into scheduleSnapshotJobs so every caller gets it automatically. --- internal/strategy/git/git.go | 3 --- internal/strategy/git/snapshot.go | 9 +++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/internal/strategy/git/git.go b/internal/strategy/git/git.go index 37279df..06a3251 100644 --- a/internal/strategy/git/git.go +++ b/internal/strategy/git/git.go @@ -199,7 +199,6 @@ func (s *Strategy) warmExistingRepos(ctx context.Context) error { if s.config.SnapshotInterval > 0 { s.scheduleSnapshotJobs(repo) - s.scheduleLFSSnapshotJobs(repo) } if s.config.RepackInterval > 0 { s.scheduleRepackJobs(repo) @@ -545,7 +544,6 @@ func (s *Strategy) startClone(ctx context.Context, repo *gitclone.Repository) er if s.config.SnapshotInterval > 0 { s.scheduleSnapshotJobs(repo) - s.scheduleLFSSnapshotJobs(repo) } if s.config.RepackInterval > 0 { s.scheduleRepackJobs(repo) @@ -576,7 +574,6 @@ func (s *Strategy) startClone(ctx context.Context, repo *gitclone.Repository) er if s.config.SnapshotInterval > 0 { s.scheduleSnapshotJobs(repo) - s.scheduleLFSSnapshotJobs(repo) } if s.config.RepackInterval > 0 { s.scheduleRepackJobs(repo) diff --git a/internal/strategy/git/snapshot.go b/internal/strategy/git/snapshot.go index 0bad5d3..8535219 100644 --- a/internal/strategy/git/snapshot.go +++ b/internal/strategy/git/snapshot.go @@ -172,6 +172,9 @@ func (s *Strategy) scheduleSnapshotJobs(repo *gitclone.Repository) { s.scheduler.SubmitPeriodicJob(repo.UpstreamURL(), "snapshot-periodic", s.config.SnapshotInterval, func(ctx context.Context) error { return s.generateAndUploadSnapshot(ctx, repo) }) + s.scheduler.SubmitPeriodicJob(repo.UpstreamURL(), "lfs-snapshot-periodic", s.config.SnapshotInterval, func(ctx context.Context) error { + return s.generateAndUploadLFSSnapshot(ctx, repo) + }) mirrorInterval := s.config.MirrorSnapshotInterval if mirrorInterval == 0 { mirrorInterval = s.config.SnapshotInterval @@ -764,12 +767,6 @@ func (s *Strategy) generateAndUploadLFSSnapshot(ctx context.Context, repo *gitcl return nil } -func (s *Strategy) scheduleLFSSnapshotJobs(repo *gitclone.Repository) { - s.scheduler.SubmitPeriodicJob(repo.UpstreamURL(), "lfs-snapshot-periodic", s.config.SnapshotInterval, func(ctx context.Context) error { - return s.generateAndUploadLFSSnapshot(ctx, repo) - }) -} - func (s *Strategy) handleLFSSnapshotRequest(w http.ResponseWriter, r *http.Request, host, pathValue string) { ctx := r.Context() logger := logging.FromContext(ctx)