let's try to avoid browser problems

This commit is contained in:
Jakob Ketterl 2019-07-15 21:35:39 +02:00
parent a15341fdcf
commit f1098801e2

View File

@ -1418,11 +1418,11 @@ var wsjt_removal_interval;
function init_wsjt_removal_timer() { function init_wsjt_removal_timer() {
if (wsjt_removal_interval) clearInterval(wsjt_removal_interval); if (wsjt_removal_interval) clearInterval(wsjt_removal_interval);
setInterval(function(){ setInterval(function(){
// let's keep 2 hours that should be plenty for most users var $elements = $('#openwebrx-panel-wsjt-message tbody tr');
var cutoff = new Date().getTime()- 2 * 60 * 60 * 1000; // limit to 1000 entries in the list since browsers get laggy at some point
$('#openwebrx-panel-wsjt-message tbody tr').filter(function(_, e){ var toRemove = $elements.length - 1000;
return $(e).data('timestamp') < cutoff; if (toRemove <= 0) return;
}).remove(); $elements.slice(0, toRemove).remove();
}, 15000); }, 15000);
} }