fix: reset ping value after reaching average count in ServiceSentinel

This commit is contained in:
naiba
2025-03-02 15:42:12 +08:00
parent 5ff77b5a6b
commit 9b6c3391ed

View File

@@ -427,6 +427,7 @@ func (ss *ServiceSentinel) worker() {
ts.ping = (ts.ping*float32(ts.count-1) + mh.Delay) / float32(ts.count)
if ts.count == Conf.AvgPingCount {
ts.count = 0
ts.ping = mh.Delay
if err := DB.Create(&model.ServiceHistory{
ServiceID: mh.GetId(),
AvgDelay: ts.ping,