changed the performance stop threshold, only enabling on short tests (so it doesnt stop multi hour ones)

This commit is contained in:
Jack 2021-11-16 13:16:03 +00:00
parent a3d303b977
commit 7d412d0c43

View file

@ -183,6 +183,7 @@ export function getTimerStats() {
}
async function timerStep() {
if (timerDebug) console.time("timer step -----------------------------");
time++;
premid();
updateTimer();
@ -192,10 +193,10 @@ async function timerStep() {
layoutfluid();
checkIfFailed(wpmAndRaw, acc);
checkIfTimeIsUp();
if (timerDebug) console.log("timer step -----------------------------");
if (timerDebug) console.timeEnd("timer step -----------------------------");
}
export function start() {
export async function start() {
clearSlowTimer();
timerStats = [];
expected = TestStats.start + interval;
@ -207,17 +208,22 @@ export function start() {
expected: expected,
nextDelay: delay,
});
if (delay < (interval / 3) * 2) {
//slow timer
setSlowTimer();
}
if (delay < interval / 3) {
//slow timer
Notifications.add(
"Stopping the test due to very bad timer performance. This would cause the test duration and other calculations to be incorrect. If this happens a lot, please report this.",
-1
);
TestLogic.fail("slow timer");
if (
(Config.mode === "time" && Config.time < 130) ||
(Config.mode === "words" && Config.words < 250)
) {
if (delay < interval / 2) {
//slow timer
setSlowTimer();
}
if (delay < interval / 10) {
//slow timer
Notifications.add(
"Stopping the test due to bad performance. This would cause test calculations to be incorrect. If this happens a lot, please report this.",
-1
);
TestLogic.fail("slow timer");
}
}
timer = setTimeout(function () {
// time++;