update:use builtin cmp func (#4879)

This commit is contained in:
me-cs
2025-05-22 23:19:13 +08:00
committed by GitHub
parent e3c371ac89
commit b109b3ef4c
4 changed files with 9 additions and 24 deletions

View File

@@ -8,7 +8,6 @@ import (
"sync"
"time"
"github.com/zeromicro/go-zero/core/mathx"
"github.com/zeromicro/go-zero/core/proc"
"github.com/zeromicro/go-zero/core/stat"
"github.com/zeromicro/go-zero/core/stringx"
@@ -264,7 +263,7 @@ func (ew *errorWindow) add(reason string) {
ew.lock.Lock()
ew.reasons[ew.index] = fmt.Sprintf("%s %s", time.Now().Format(timeFormat), reason)
ew.index = (ew.index + 1) % numHistoryReasons
ew.count = mathx.MinInt(ew.count+1, numHistoryReasons)
ew.count = min(ew.count+1, numHistoryReasons)
ew.lock.Unlock()
}