Remove 90-day history (not used) to avoid CPU limit exceed on free tier
parent
a0eabeec45
commit
e448e95909
|
|
@ -262,8 +262,8 @@ export default {
|
||||||
// append to latency data
|
// append to latency data
|
||||||
let latencyLists = state.latency[monitor.id] || {
|
let latencyLists = state.latency[monitor.id] || {
|
||||||
recent: [],
|
recent: [],
|
||||||
all: [],
|
|
||||||
}
|
}
|
||||||
|
latencyLists.all = []
|
||||||
|
|
||||||
const record = {
|
const record = {
|
||||||
loc: checkLocation,
|
loc: checkLocation,
|
||||||
|
|
@ -271,17 +271,11 @@ export default {
|
||||||
time: currentTimeSecond,
|
time: currentTimeSecond,
|
||||||
}
|
}
|
||||||
latencyLists.recent.push(record)
|
latencyLists.recent.push(record)
|
||||||
if (latencyLists.all.length === 0 || currentTimeSecond - latencyLists.all.slice(-1)[0].time > 60 * 60) {
|
|
||||||
latencyLists.all.push(record)
|
|
||||||
}
|
|
||||||
|
|
||||||
// discard old data
|
// discard old data
|
||||||
while (latencyLists.recent[0]?.time < currentTimeSecond - 12 * 60 * 60) {
|
while (latencyLists.recent[0]?.time < currentTimeSecond - 12 * 60 * 60) {
|
||||||
latencyLists.recent.shift()
|
latencyLists.recent.shift()
|
||||||
}
|
}
|
||||||
while (latencyLists.all[0]?.time < currentTimeSecond - 90 * 24 * 60 * 60) {
|
|
||||||
latencyLists.all.shift()
|
|
||||||
}
|
|
||||||
state.latency[monitor.id] = latencyLists
|
state.latency[monitor.id] = latencyLists
|
||||||
|
|
||||||
// discard old incidents
|
// discard old incidents
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue