Skip to content
Snippets Groups Projects
Commit 6d701821 authored by Jake Read's avatar Jake Read
Browse files

rollover bug

parent d021b182
Branches
No related tags found
No related merge requests found
......@@ -58,7 +58,7 @@ jQuery.get('/startLocal/ltv-bridge.js', (res) => {
type: "plot update request",
lastRecvdIndice: lastRecvdIndice
}))
setTimeout(reqData, 100)
setTimeout(reqData, 50)
} else {
console.error("WS Closed")
}
......
......@@ -20,7 +20,15 @@ WSSPipe.start().then((ws) => {
} else if (msg.lastRecvdIndice + 500 < indice){ // missed more than 500 data pts, reset
msg.lastRecvdIndice = indice - 500
}
resp.array = store.slice(msg.lastRecvdIndice)
// find indice (by identifier) of the requested
let ind = store.find((elem) => {
return (elem[0] == msg.lastRecvdIndice)
})
if(ind){
resp.array = store.slice(ind)
} else {
resp.array = []
}
ws.send(JSON.stringify(resp))
}
}
......@@ -112,8 +120,9 @@ let onPacket = (pck) => {
store.push([indice, data.inspState, data.proxPres, data.xdcrFlow, data.volume])
indice ++
// occasionally lop off 1000 entries, so as not to explode local memory
if(store.length > 5000){
store = store.slice(1000)
if(store.length > 3000){
console.log("rollover")
store = store.slice(-2000)
}
//console.log(data)
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment