Browse Source

Fix rrd update when value less than 1

tags/v5.8.0
710leo 6 years ago
parent
commit
0d5ca9306e
2 changed files with 7 additions and 1 deletions
  1. +6
    -0
      src/modules/judge/cache/linkedlist.go
  2. +1
    -1
      src/modules/tsdb/rrdtool/rrdtool.go

+ 6
- 0
src/modules/judge/cache/linkedlist.go View File

@@ -90,6 +90,12 @@ func (ll *SafeLinkedList) HistoryData(limit int) ([]*dataobj.HistoryData, bool)
currentElement := firstElement currentElement := firstElement
for i < limit { for i < limit {
nextElement := currentElement.Next() nextElement := currentElement.Next()

if nextElement == nil {
isEnough = false
return vs, isEnough
}

vs[i] = &dataobj.HistoryData{ vs[i] = &dataobj.HistoryData{
Timestamp: nextElement.Value.(*dataobj.JudgeItem).Timestamp, Timestamp: nextElement.Value.(*dataobj.JudgeItem).Timestamp,
Value: dataobj.JsonFloat(nextElement.Value.(*dataobj.JudgeItem).Value), Value: dataobj.JsonFloat(nextElement.Value.(*dataobj.JudgeItem).Value),


+ 1
- 1
src/modules/tsdb/rrdtool/rrdtool.go View File

@@ -47,7 +47,7 @@ func update(filename string, items []*dataobj.TsdbItem) error {
if v > 1e+300 || (v < 1e-300 && v > 0) { if v > 1e+300 || (v < 1e-300 && v > 0) {
continue continue
} }
u.Cache(item.Timestamp, int(item.Value))
u.Cache(item.Timestamp, item.Value)
} }


return u.Update() return u.Update()


Loading…
Cancel
Save