From 7b71185bb8a37568c638a188299af98f513d8a70 Mon Sep 17 00:00:00 2001 From: Danielv123 Date: Mon, 13 Mar 2017 18:46:43 +0100 Subject: [PATCH] Avoid extreme negatives in stat reporting --- client.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client.js b/client.js index 08725a1a..4453c735 100644 --- a/client.js +++ b/client.js @@ -463,6 +463,9 @@ function instanceManagement() { for(let key in oldFlowStats) { // get production per minute payload[key] = Math.floor((payload[key] - oldFlowStats[key])/(timestamp - oldTimestamp)*60000); + if(payload[key] < 0) { + payload[key] = 0; + } } // console.log("Recorded flows, copper plate since last time: " + payload["copper-plate"]); needle.post(config.masterIP + ":" + config.masterPort + '/logStats', {timestamp: timestamp, slaveID: instanceconfig.unique,data: payload}, function (err, response, body) {