From: HAOYUatHZ Date: Mon, 2 Sep 2019 02:19:07 +0000 (+0800) Subject: add RequiredRttMS X-Git-Url: http://git.osdn.net/view?p=bytom%2Fvapor.git;a=commitdiff_plain;h=d801643f83f0f24b0eca395f853aa1606263d25b add RequiredRttMS --- diff --git a/docs/precog/config_example.json b/docs/precog/config_example.json index 8a5f2ece..dcb586b4 100644 --- a/docs/precog/config_example.json +++ b/docs/precog/config_example.json @@ -14,6 +14,9 @@ "log_mode" : true }, "check_frequency_minutes" : 30, + "policy" : { + "required_rtt_ms" : 2000, + }, "seeds" : [ { "xpub" : "f2767279cd01ed8793808e0542a18958e1a2f3a6b6fe5328ec79596a022bc6f085951a98a631917563f86bb91db9159dd2969ff9d690fc12b250baff2b6f6a1d", diff --git a/toolbar/precog/monitor/stats.go b/toolbar/precog/monitor/stats.go index 13c8818e..dd06b7e1 100644 --- a/toolbar/precog/monitor/stats.go +++ b/toolbar/precog/monitor/stats.go @@ -147,9 +147,9 @@ func (m *monitor) processPeerInfo(dbTx *gorm.DB, peerInfo *peers.PeerInfo) error // update latest liveness latestLiveness := ormNodeLivenesses[0] rttMS := ping.Nanoseconds() / 1000000 - if rttMS > 0 && rttMS < 2000 { + if rttMS > 0 && uint64(rttMS) <= m.cfg.Policy.RequiredRttMS { ormNode.Status = common.NodeHealthyStatus - } else if rttMS > 2000 { + } else if uint64(rttMS) > m.cfg.Policy.RequiredRttMS { ormNode.Status = common.NodeCongestedStatus } if rttMS != 0 {