OSDN Git Service

fix nanoseconds
authorHAOYUatHZ <haoyu@protonmail.com>
Sun, 1 Sep 2019 03:23:48 +0000 (11:23 +0800)
committerHAOYUatHZ <haoyu@protonmail.com>
Sun, 1 Sep 2019 03:23:48 +0000 (11:23 +0800)
toolbar/precog/monitor/stats.go

index 6e2cc1b..614843f 100644 (file)
@@ -146,7 +146,7 @@ func (m *monitor) processPeerInfo(dbTx *gorm.DB, peerInfo *peers.PeerInfo) error
 
        // update latest liveness
        latestLiveness := ormNodeLivenesses[0]
 
        // update latest liveness
        latestLiveness := ormNodeLivenesses[0]
-       lantencyMS := ping.Nanoseconds() / 1000
+       lantencyMS := ping.Nanoseconds() / 1000000
        if lantencyMS != 0 {
                ormNode.AvgLantencyMS = sql.NullInt64{
                        Int64: (ormNode.AvgLantencyMS.Int64*int64(latestLiveness.PongTimes) + lantencyMS) / int64(latestLiveness.PongTimes+1),
        if lantencyMS != 0 {
                ormNode.AvgLantencyMS = sql.NullInt64{
                        Int64: (ormNode.AvgLantencyMS.Int64*int64(latestLiveness.PongTimes) + lantencyMS) / int64(latestLiveness.PongTimes+1),