OSDN Git Service
(root)
/
bytom
/
vapor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3f1aeb4
)
fix status
author
HAOYUatHZ
<haoyu@protonmail.com>
Sun, 1 Sep 2019 06:49:31 +0000
(14:49 +0800)
committer
HAOYUatHZ
<haoyu@protonmail.com>
Sun, 1 Sep 2019 06:49:31 +0000
(14:49 +0800)
toolbar/precog/monitor/stats.go
patch
|
blob
|
history
diff --git
a/toolbar/precog/monitor/stats.go
b/toolbar/precog/monitor/stats.go
index
af5942b
..
4a57da3
100644
(file)
--- a/
toolbar/precog/monitor/stats.go
+++ b/
toolbar/precog/monitor/stats.go
@@
-146,13
+146,18
@@
func (m *monitor) processPeerInfo(dbTx *gorm.DB, peerInfo *peers.PeerInfo) error
// update latest liveness
latestLiveness := ormNodeLivenesses[0]
// update latest liveness
latestLiveness := ormNodeLivenesses[0]
-
lantency
MS := ping.Nanoseconds() / 1000000
- if
lantency
MS != 0 {
+
rtt
MS := ping.Nanoseconds() / 1000000
+ if
rtt
MS != 0 {
ormNode.AvgRttMS = sql.NullInt64{
ormNode.AvgRttMS = sql.NullInt64{
- Int64: (ormNode.AvgRttMS.Int64*int64(latestLiveness.PongTimes) +
lantency
MS) / int64(latestLiveness.PongTimes+1),
+ Int64: (ormNode.AvgRttMS.Int64*int64(latestLiveness.PongTimes) +
rtt
MS) / int64(latestLiveness.PongTimes+1),
Valid: true,
}
}
Valid: true,
}
}
+ if rttMS > 0 && rttMs < 2000 {
+ ormNode.Status = common.NodeHealthyStatus
+ } else if rttMS > 2000 {
+ ormNode.Status = common.NodeCongestedStatus
+ }
latestLiveness.PongTimes += 1
if peerInfo.Height != 0 {
latestLiveness.BestHeight = peerInfo.Height
latestLiveness.PongTimes += 1
if peerInfo.Height != 0 {
latestLiveness.BestHeight = peerInfo.Height