test fix for historical graph retaining too much data

This commit is contained in:
Nick Krecklow 2020-04-22 17:30:47 -05:00
parent e226066a61
commit 0402df0bc6
No known key found for this signature in database
GPG Key ID: 5F149FDE156FFA94

@ -171,13 +171,8 @@ class ServerRegistration {
this._lastGraphDataPush = timestamp
// Trim old graphPoints according to graphDuration
for (let i = 1; i < this.graphData.length; i++) {
// Find a break point where i - 1 is too old and i is new
if (timestamp - this.graphData[i - 1][0] > config.graphDuration && timestamp - this.graphData[i] <= config.graphDuration) {
this.graphData.splice(0, i)
break
}
}
const filterTimestamp = new Date().getTime() - config.graphDuration
this.graphData = this.graphData.filter(point => point[0] >= filterTimestamp)
return true
}