MCPcopy Index your code
hub / github.com/monkeytypegame/monkeytype / checkIfTimerIsSlow

Function checkIfTimerIsSlow

frontend/src/ts/test/test-timer.ts:328–359  ·  view source on GitHub ↗
(drift: number)

Source from the content-addressed store, hash-verified

326}
327
328function checkIfTimerIsSlow(drift: number): void {
329 if (!slowTimerFailEnabled) return;
330 if (
331 (Config.mode === "time" && Config.time < 130 && Config.time > 0) ||
332 (Config.mode === "words" && Config.words < 250 && Config.words > 0)
333 ) {
334 if (drift > 125) {
335 //slow timer
336 SlowTimer.set();
337 setLowFpsMode();
338 }
339 if (drift > 250) {
340 slowTimerCount++;
341 }
342
343 if (drift > 500 || slowTimerCount > 5) {
344 //slow timer
345
346 showNoticeNotification(
347 'This could be caused by "efficiency mode" on Microsoft Edge.',
348 );
349
350 slowTimerNotifIds.push(
351 showErrorNotification(
352 "Stopping the test due to bad performance. This would cause test calculations to be incorrect. If this happens a lot, please report this.",
353 ),
354 );
355
356 timerEvent.dispatch({ key: "fail", value: "slow timer" });
357 }
358 }
359}
360
361export async function start(now: number): Promise<void> {
362 SlowTimer.clear();

Callers 2

test-timer.tsFile · 0.85
_startOldFunction · 0.85

Calls 6

setLowFpsModeFunction · 0.90
showNoticeNotificationFunction · 0.90
showErrorNotificationFunction · 0.90
setMethod · 0.80
pushMethod · 0.80
dispatchMethod · 0.80

Tested by

no test coverage detected