Fix rrd update when value less than 1

This commit is contained in:
710leo 2020-05-24 17:40:22 +08:00
parent fb070a9843
commit 0d5ca9306e
2 changed files with 7 additions and 1 deletions

View File

@ -90,6 +90,12 @@ func (ll *SafeLinkedList) HistoryData(limit int) ([]*dataobj.HistoryData, bool)
currentElement := firstElement
for i < limit {
nextElement := currentElement.Next()
if nextElement == nil {
isEnough = false
return vs, isEnough
}
vs[i] = &dataobj.HistoryData{
Timestamp: nextElement.Value.(*dataobj.JudgeItem).Timestamp,
Value: dataobj.JsonFloat(nextElement.Value.(*dataobj.JudgeItem).Value),

View File

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