You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Repos that haven't had a client request in 24h (configurable via
idle-timeout) no longer re-arm their snapshot/repack periodic jobs.
When a request arrives for an idle repo, the jobs are re-scheduled.
Copy file name to clipboardExpand all lines: internal/strategy/git/git.go
+35Lines changed: 35 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,7 @@ type Config struct {
49
49
RepackInterval time.Duration`hcl:"repack-interval,optional" help:"How often to run full repack. 0 disables." default:"0"`
50
50
ZstdThreadsint`hcl:"zstd-threads,optional" help:"Threads for zstd compression/decompression. 0 = all CPU cores; useful for short-lived CLI invocations but risky on a long-running server where multiple snapshot/restore operations can run concurrently." default:"4"`
51
51
BundleCacheTTL time.Duration`hcl:"bundle-cache-ttl,optional" help:"TTL of cached server-side git bundles." default:"2h"`
52
+
IdleTimeout time.Duration`hcl:"idle-timeout,optional" help:"Stop periodic jobs for repos with no client requests for this duration. 0 disables." default:"72h"`
52
53
}
53
54
54
55
typeStrategystruct {
@@ -66,6 +67,7 @@ type Strategy struct {
66
67
snapshotSpools sync.Map// keyed by upstream URL, values are *snapshotSpoolEntry
67
68
coldSnapshotMu sync.Map// keyed by upstream URL, values are *coldSnapshotEntry
68
69
deferredRestoreOnce sync.Map// keyed by upstream URL, ensures at most one deferred restore per repo
70
+
idledRepos sync.Map// keyed by upstream URL, set when periodic jobs idle out
69
71
metrics*gitMetrics
70
72
repoCounts*RepoCounts
71
73
ready atomic.Bool
@@ -197,6 +199,38 @@ func (s *Strategy) Ready() bool {
0 commit comments