From 172bdb3fc1fb6d3835f2bc1c68991d7118014803 Mon Sep 17 00:00:00 2001 From: Tim Harrold Date: Tue, 2 Jul 2024 20:58:25 +0000 Subject: [PATCH] Fix restartAttemptPeriod comparison in restart tracker --- ecs-agent/api/container/restart/restart_tracker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ecs-agent/api/container/restart/restart_tracker.go b/ecs-agent/api/container/restart/restart_tracker.go index 0993ead5a75..d455fb1bd59 100644 --- a/ecs-agent/api/container/restart/restart_tracker.go +++ b/ecs-agent/api/container/restart/restart_tracker.go @@ -92,7 +92,7 @@ func (rt *RestartTracker) ShouldRestart(exitCode *int, startedAt time.Time, if !rt.LastRestartAt.IsZero() { startTime = rt.LastRestartAt } - if time.Since(startTime) < time.Duration(rt.RestartPolicy.RestartAttemptPeriod)*time.Second { + if time.Since(startTime).Seconds() < float64(rt.RestartPolicy.RestartAttemptPeriod) { return false, "attempt reset period has not elapsed" } return true, ""