mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-24 08:23:12 +09:00
Avoid extreme negatives in stat reporting
This commit is contained in:
1 parent
5cf91e7a3d
commit
7b71185bb8
1 file changed
+3
@@ -463,6 +463,9 @@ function instanceManagement() {
|
|||||||
for(let key in oldFlowStats) {
|
for(let key in oldFlowStats) {
|
||||||
// get production per minute
|
// get production per minute
|
||||||
payload[key] = Math.floor((payload[key] - oldFlowStats[key])/(timestamp - oldTimestamp)*60000);
|
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"]);
|
// 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) {
|
needle.post(config.masterIP + ":" + config.masterPort + '/logStats', {timestamp: timestamp, slaveID: instanceconfig.unique,data: payload}, function (err, response, body) {
|
||||||
|
|||||||
Reference in new issue
Block a user