Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
Wanghb1 committed Dec 2, 2024
1 parent 3e7fc61 commit af00d47
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/protect/protect.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ var (
)

const (
maxInterval = 120 * time.Second
minInterval = 0 * time.Second
defaultRestartProtectInterval = 120 * time.Second
maxInterval = 120
minInterval = 0
defaultRestartProtectInterval = 120
)

func Init() {
enableInstanceNullProtect = config.GetBool("instance_null_protect.enable", false)
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) {
Expand Down

0 comments on commit af00d47

Please sign in to comment.