mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
chore: UNCLOUD_HEALTH_MONITOR_PERIOD accepts duration (10s, 500ms, 0)
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -261,14 +260,15 @@ func (c *ServiceContainer) UnmarshalJSON(data []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultHealthMonitorPeriod is the default duration to wait before checking that the container is still running
|
// DefaultHealthMonitorPeriod is the default duration (5 seconds) to wait before checking that the container is still
|
||||||
// and not restarting. Can be overridden with the UNCLOUD_HEALTH_MONITOR_PERIOD_MS environment variable.
|
// running and not restarting. Can be overridden with the UNCLOUD_HEALTH_MONITOR_PERIOD environment variable
|
||||||
|
// (e.g. "10s" or "0").
|
||||||
var DefaultHealthMonitorPeriod = defaultHealthMonitorPeriod()
|
var DefaultHealthMonitorPeriod = defaultHealthMonitorPeriod()
|
||||||
|
|
||||||
func defaultHealthMonitorPeriod() time.Duration {
|
func defaultHealthMonitorPeriod() time.Duration {
|
||||||
if v, ok := os.LookupEnv("UNCLOUD_HEALTH_MONITOR_PERIOD_MS"); ok {
|
if v, ok := os.LookupEnv("UNCLOUD_HEALTH_MONITOR_PERIOD"); ok {
|
||||||
if ms, err := strconv.Atoi(v); err == nil {
|
if d, err := time.ParseDuration(v); err == nil {
|
||||||
return time.Duration(ms) * time.Millisecond
|
return d
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user