Control xhttp concurrency

This commit is contained in:
logicog
2026-03-10 06:16:18 +01:00
parent c2f5a91763
commit fa37940075
10 changed files with 106 additions and 45 deletions
+8 -5
View File
@@ -3,7 +3,6 @@ var lagInterval = Number();
function lagForm() {
if (!numPorts)
return;
clearInterval(lagInterval);
for (let j=0; j < 4; j++) {
var lag = "mLAG" + j
console.log("Adding LAG " + lag)
@@ -35,9 +34,6 @@ function setL(p, c){
console.log("LAG setting: ", p, " to ", c);
document.getElementById(p).checked=c;
}
window.addEventListener("load", function() {
lagInterval = setInterval(lagForm, 200);
});
function fetchLag() {
var xhttp = new XMLHttpRequest();
@@ -58,7 +54,7 @@ function fetchLag() {
}
};
xhttp.open("GET", `/lag.json`, true);
xhttp.send();
sendXHTTP(xhttp);
}
async function lagSub(l) {
var cmd = "lag " + l;
@@ -76,3 +72,10 @@ async function lagSub(l) {
console.error(`Error: ${err}`);
}
}
window.addEventListener("load", function() {
update( () => {
lagForm();
const interval = setInterval(update, 2000);
});
});