diff --git a/src/Netscript/NetscriptHelpers.ts b/src/Netscript/NetscriptHelpers.ts index 6104f0951..9f94fb3ed 100644 --- a/src/Netscript/NetscriptHelpers.ts +++ b/src/Netscript/NetscriptHelpers.ts @@ -33,7 +33,6 @@ import { BaseServer } from "../Server/BaseServer"; import { dialogBoxCreate } from "../ui/React/DialogBox"; import { checkEnum } from "../utils/helpers/enum"; import { RamCostConstants } from "./RamCostGenerator"; -import { Settings } from "../Settings/Settings"; export const helpers = { string, @@ -304,15 +303,6 @@ function checkSingularityAccess(ctx: NetscriptContext): void { } } -/** The last time the page was able to update this tracking variable, which is used for timeout detection */ -let lastTime = Date.now(); -setInterval(() => (lastTime = Date.now()), 1000); -// This event should prevent false positive timeout errors when user alt-tabs / otherwise hides the window -document.addEventListener( - "visibilitychange", - () => (lastTime = document.visibilityState === "hidden" ? Infinity : Date.now()), -); - /** Create an error if a script is dead or if concurrent ns function calls are made */ function checkEnvFlags(ctx: NetscriptContext): void { const ws = ctx.workerScript; @@ -333,17 +323,6 @@ function checkEnvFlags(ctx: NetscriptContext): void { "CONCURRENCY", ); } - // 8s allows scripts at least 7s of synchronous execution time before error, since updates are every 1s. - if (Settings.infiniteLoopDetection && Date.now() - 8000 > lastTime) { - // Prevent error getting piggybacked to another script due to a stale timer. - lastTime = Date.now(); - - throw makeRuntimeErrorMsg( - ctx, - "Possible infinite loop detected while running function.\nThis error is enabled by Options -> System -> Infinite loop detection.", - "EXECUTION TIMEOUT", - ); - } } /** Set a timeout for performing a task, mark the script as busy in the meantime. */ diff --git a/src/Settings/Settings.ts b/src/Settings/Settings.ts index 0208f55c3..693db595a 100644 --- a/src/Settings/Settings.ts +++ b/src/Settings/Settings.ts @@ -102,8 +102,6 @@ export const Settings = { useEngineeringNotation: false, /** Whether to disable suffixes and always use exponential form (scientific or engineering). */ disableSuffixes: false, - /** Whether to check for execution timeout errors */ - infiniteLoopDetection: true, load(saveString: string) { const save = JSON.parse(saveString);