Merge pull request #52317 from ogulcanaydogan/fix/46747-health-start-period-interval

fix: cap health check start interval by remaining start period
This commit is contained in:
Paweł Gronowski authored and GitHub committed 2026-09-01 16:25:08 +02:00
commit 69b8083c9b
1 file changed
+9 -1
+9 -1
View File
@@ -263,7 +263,8 @@ func monitor(d *Daemon, c *container.Container, stop chan struct{}, probe probe)
c.Unlock()
getInterval := func() time.Duration {
if time.Since(started) >= startPeriod {
sinceStart := time.Since(started)
if sinceStart >= startPeriod {
return probeInterval
}
c.Lock()
@@ -271,6 +272,13 @@ func monitor(d *Daemon, c *container.Container, stop chan struct{}, probe probe)
c.Unlock()
if status == containertypes.Starting {
// Cap the interval so we don't sleep past the end of the
// start period. Without this, a large StartInterval would
// delay the transition to the regular probe cadence.
remaining := startPeriod - sinceStart
if startInterval > remaining {
return remaining
}
return startInterval
}
return probeInterval