From af00d4702d5980e9171f775c6bce43a39449cf81 Mon Sep 17 00:00:00 2001 From: wanghongbo Date: Mon, 2 Dec 2024 17:11:26 +0800 Subject: [PATCH] review --- pkg/protect/protect.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/protect/protect.go b/pkg/protect/protect.go index 6232d5355..525e7313c 100644 --- a/pkg/protect/protect.go +++ b/pkg/protect/protect.go @@ -26,9 +26,9 @@ var ( ) const ( - maxInterval = 120 * time.Second - minInterval = 0 * time.Second - defaultRestartProtectInterval = 120 * time.Second + maxInterval = 120 + minInterval = 0 + defaultRestartProtectInterval = 120 ) func Init() { @@ -36,8 +36,8 @@ func Init() { restartProtectInterval = time.Duration(config.GetInt("instance_null_protect.restart_protect_interval", 120)) * time.Second if restartProtectInterval > maxInterval || restartProtectInterval < minInterval { log.Warn(fmt.Sprintf("invalid instance_null_protect.restart_protect_interval: %d,"+ - " must between %d-%d inclusively", restartProtectInterval, minInterval, maxInterval)) - restartProtectInterval = defaultRestartProtectInterval + " must between %d-%ds inclusively", restartProtectInterval, minInterval, maxInterval)) + restartProtectInterval = defaultRestartProtectInterval * time.Second } RestartProtectHttpCode = config.GetInt("instance_null_protect.http_status", http.StatusNotModified) if !util.Contains(validProtectCode, RestartProtectHttpCode) {