@@ -32,6 +32,11 @@ let timer: NodeJS.Timeout | null = null;
3232const interval = 1000 ;
3333let expected = 0 ;
3434
35+ let slowTimerFailEnabled = true ;
36+ export function disableSlowTimerFail ( ) : void {
37+ slowTimerFailEnabled = false ;
38+ }
39+
3540let timerDebug = false ;
3641export function enableTimerDebug ( ) : void {
3742 timerDebug = true ;
@@ -234,30 +239,32 @@ export async function start(): Promise<void> {
234239 expected : expected ,
235240 nextDelay : delay ,
236241 } ) ;
237- if (
238- ( Config . mode === "time" && Config . time < 130 && Config . time > 0 ) ||
239- ( Config . mode === "words" && Config . words < 250 && Config . words > 0 )
240- ) {
241- if ( delay < interval / 2 ) {
242- //slow timer
243- SlowTimer . set ( ) ;
244- setLowFpsMode ( ) ;
245- }
246- if ( delay < interval / 10 ) {
247- slowTimerCount ++ ;
248- if ( slowTimerCount > 5 ) {
242+ if ( slowTimerFailEnabled ) {
243+ if (
244+ ( Config . mode === "time" && Config . time < 130 && Config . time > 0 ) ||
245+ ( Config . mode === "words" && Config . words < 250 && Config . words > 0 )
246+ ) {
247+ if ( delay < interval / 2 ) {
249248 //slow timer
250-
251- Notifications . add (
252- 'This could be caused by "efficiency mode" on Microsoft Edge.' ,
253- ) ;
254-
255- Notifications . add (
256- "Stopping the test due to bad performance. This would cause test calculations to be incorrect. If this happens a lot, please report this." ,
257- - 1 ,
258- ) ;
259-
260- TimerEvent . dispatch ( "fail" , "slow timer" ) ;
249+ SlowTimer . set ( ) ;
250+ setLowFpsMode ( ) ;
251+ }
252+ if ( delay < interval / 10 ) {
253+ slowTimerCount ++ ;
254+ if ( slowTimerCount > 5 ) {
255+ //slow timer
256+
257+ Notifications . add (
258+ 'This could be caused by "efficiency mode" on Microsoft Edge.' ,
259+ ) ;
260+
261+ Notifications . add (
262+ "Stopping the test due to bad performance. This would cause test calculations to be incorrect. If this happens a lot, please report this." ,
263+ - 1 ,
264+ ) ;
265+
266+ TimerEvent . dispatch ( "fail" , "slow timer" ) ;
267+ }
261268 }
262269 }
263270 }
0 commit comments