File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -300,9 +300,15 @@ func (s *gcScheduler) run(ctx context.Context) {
300300 if err != nil {
301301 log .G (ctx ).WithError (err ).Error ("garbage collection failed" )
302302 collectionCounter .WithValues ("fail" ).Inc ()
303-
304- // Reschedule garbage collection for same duration + 1 second
305- schedC , nextCollection = schedule (nextCollection .Sub (* lastCollection ) + time .Second )
303+ var retryDelay time.Duration
304+ if lastCollection != nil {
305+ // If we have a previous collection time, reschedule based on that interval.
306+ retryDelay = nextCollection .Sub (* lastCollection ) + time .Second
307+ } else {
308+ // If this is the first collection and it failed, use the default schedule delay.
309+ retryDelay = s .scheduleDelay
310+ }
311+ schedC , nextCollection = schedule (retryDelay )
306312
307313 // Update last collection time even though failure occurred
308314 lastCollection = & last
You can’t perform that action at this time.
0 commit comments