Skip to content

Commit

Permalink
merge PR #111
Browse files Browse the repository at this point in the history
  • Loading branch information
vinllen committed Jul 3, 2019
2 parents d02ff3b + 868449a commit cd1ee35
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/redis-shake/metric/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package metric
import (
"encoding/json"
"fmt"
"math"
"strconv"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -42,7 +43,7 @@ func (p *Percent) Get(returnString bool) interface{} {
if returnString {
return "null"
} else {
return int64(^uint64(0) >> 1) // int64_max
return math.MaxFloat64
}
} else {
dividend := atomic.LoadUint64(&p.Dividend)
Expand Down Expand Up @@ -225,7 +226,10 @@ func (m *Metric) GetAvgDelay() interface{} {
}

func (m *Metric) GetAvgDelayFloat64() float64 {
return float64(m.AvgDelay.Get(false).(int64))
if avgDelay, ok := m.AvgDelay.Get(false).(float64); ok {
return avgDelay
}
return math.MaxFloat64
}

func (m *Metric) AddNetworkFlow(dbSyncerID int, val uint64) {
Expand Down

0 comments on commit cd1ee35

Please sign in to comment.