File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -234,6 +234,7 @@ func schedule(d time.Duration) (<-chan time.Time, *time.Time) {
234234}
235235
236236func (s * gcScheduler ) run (ctx context.Context ) {
237+ const minimumGCTime = float64 (5 * time .Millisecond )
237238 var (
238239 schedC <- chan time.Time
239240
@@ -331,6 +332,11 @@ func (s *gcScheduler) run(ctx context.Context) {
331332 // runtime in between gc to reach the pause threshold.
332333 // Pause threshold is always 0.0 < threshold <= 0.5
333334 avg := float64 (gcTimeSum ) / float64 (collections )
335+ // Enforce that avg is no less than minimumGCTime
336+ // to prevent immediate rescheduling
337+ if avg < minimumGCTime {
338+ avg = minimumGCTime
339+ }
334340 interval = time .Duration (avg / s .pauseThreshold - avg )
335341 }
336342
You can’t perform that action at this time.
0 commit comments