mirror of
https://github.com/nezhahq/nezha.git
synced 2025-03-12 00:38:13 -04:00
fix: reset ping value after reaching average count in ServiceSentinel
Some checks are pending
CodeQL / Analyze (go) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
Contributors / contributors (push) Waiting to run
Sync / sync-to-jihulab (push) Waiting to run
Run Tests / tests (macos) (push) Waiting to run
Run Tests / tests (ubuntu) (push) Waiting to run
Run Tests / tests (windows) (push) Waiting to run
Some checks are pending
CodeQL / Analyze (go) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
Contributors / contributors (push) Waiting to run
Sync / sync-to-jihulab (push) Waiting to run
Run Tests / tests (macos) (push) Waiting to run
Run Tests / tests (ubuntu) (push) Waiting to run
Run Tests / tests (windows) (push) Waiting to run
This commit is contained in:
parent
5ff77b5a6b
commit
9b6c3391ed
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user