From ae4cd4cd1af3bbb011d8d87694f103b8c0c3b5f3 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Wed, 31 Jul 2019 20:57:22 +0200 Subject: [PATCH] do some pruning while loading history --- html/script.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/html/script.js b/html/script.js index d05cdd8..8d970c6 100644 --- a/html/script.js +++ b/html/script.js @@ -501,13 +501,22 @@ function parse_history() { } - if(false) { + if(h != 0 && h % Math.floor(PositionHistoryBuffer.length/4) == 0) { + + var newPlanes = []; for (var i = 0; i < PlanesOrdered.length; ++i) { var plane = PlanesOrdered[i]; - plane.updateTick(now, last); - } - refreshTableInfo(); - reaper(); + if (plane.seen > 600) { + // Reap it. + delete Planes[plane.icao]; + plane.destroy(); + } else { + // Keep it. + newPlanes.push(plane); + } + }; + + PlanesOrdered = newPlanes; } if (uat) {