From b48ebe2acc6035f403623e0d52cef7fb21259129 Mon Sep 17 00:00:00 2001 From: Pasha Sviderski Date: Sun, 1 Mar 2026 08:08:57 +1000 Subject: [PATCH] chore: UNCLOUD_HEALTH_MONITOR_PERIOD accepts duration (10s, 500ms, 0) --- pkg/api/container.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/api/container.go b/pkg/api/container.go index b9f69365..c5742e3d 100644 --- a/pkg/api/container.go +++ b/pkg/api/container.go @@ -6,7 +6,6 @@ import ( "io" "net/netip" "os" - "strconv" "strings" "time" @@ -261,14 +260,15 @@ func (c *ServiceContainer) UnmarshalJSON(data []byte) error { return nil } -// DefaultHealthMonitorPeriod is the default duration to wait before checking that the container is still running -// and not restarting. Can be overridden with the UNCLOUD_HEALTH_MONITOR_PERIOD_MS environment variable. +// DefaultHealthMonitorPeriod is the default duration (5 seconds) to wait before checking that the container is still +// running and not restarting. Can be overridden with the UNCLOUD_HEALTH_MONITOR_PERIOD environment variable +// (e.g. "10s" or "0"). var DefaultHealthMonitorPeriod = defaultHealthMonitorPeriod() func defaultHealthMonitorPeriod() time.Duration { - if v, ok := os.LookupEnv("UNCLOUD_HEALTH_MONITOR_PERIOD_MS"); ok { - if ms, err := strconv.Atoi(v); err == nil { - return time.Duration(ms) * time.Millisecond + if v, ok := os.LookupEnv("UNCLOUD_HEALTH_MONITOR_PERIOD"); ok { + if d, err := time.ParseDuration(v); err == nil { + return d } }