mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-06 13:40:06 +00:00
fix: reset ping value after reaching average count in ServiceSentinel
This commit is contained in:
@@ -427,6 +427,7 @@ func (ss *ServiceSentinel) worker() {
|
|||||||
ts.ping = (ts.ping*float32(ts.count-1) + mh.Delay) / float32(ts.count)
|
ts.ping = (ts.ping*float32(ts.count-1) + mh.Delay) / float32(ts.count)
|
||||||
if ts.count == Conf.AvgPingCount {
|
if ts.count == Conf.AvgPingCount {
|
||||||
ts.count = 0
|
ts.count = 0
|
||||||
|
ts.ping = mh.Delay
|
||||||
if err := DB.Create(&model.ServiceHistory{
|
if err := DB.Create(&model.ServiceHistory{
|
||||||
ServiceID: mh.GetId(),
|
ServiceID: mh.GetId(),
|
||||||
AvgDelay: ts.ping,
|
AvgDelay: ts.ping,
|
||||||
|
|||||||
Reference in New Issue
Block a user