allbuild commit 8159dad5

This commit is contained in:
Olivier Gagnon 2022-05-24 16:57:25 -04:00
parent 8159dad5fa
commit ce61f06319
7 changed files with 15 additions and 11 deletions

2
dist/main.bundle.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -129,7 +129,7 @@
"electron:packager-win": "electron-packager .package bitburner --platform win32 --arch x64 --out .build --overwrite --icon .package/icon.png",
"electron:packager-mac": "electron-packager .package bitburner --platform darwin --arch x64 --out .build --overwrite --icon .package/icon.png",
"electron:packager-linux": "electron-packager .package bitburner --platform linux --arch x64 --out .build --overwrite --icon .package/icon.png",
"allbuild": "npm run build && npm run electron && git add --all && git commit -m \"allbuild commit $(git rev-parse --short HEAD)\" && git push -f -u origin dev",
"allbuild": "npm run build && npm run electron && git add --all && git commit -m \"allbuild commit $(git rev-parse --short HEAD)\" && git push -u origin dev",
"preversion": "npm install && npm run test",
"version": "sh ./tools/build-release.sh && git add --all",
"postversion": "git push -u origin dev && git push --tags",

@ -227,7 +227,7 @@ export const CONSTANTS: {
// BitNode/Source-File related stuff
TotalNumBitNodes: 24,
InfiniteLoopLimit: 1000,
InfiniteLoopLimit: 2000,
Donations: 7,

@ -96,11 +96,15 @@ function wrapFunction(
const safetyEnabled = Settings.InfinityLoopSafety;
function wrappedFunction(...args: unknown[]): unknown {
helpers.updateDynamicRam(ctx.function, getRamCost(Player, ...tree, ctx.function));
if (safetyEnabled) workerScript.infiniteLoopSafetyCounter++;
if (workerScript.infiniteLoopSafetyCounter > CONSTANTS.InfiniteLoopLimit)
throw new Error(
`Infinite loop without sleep detected. ${CONSTANTS.InfiniteLoopLimit} ns functions were called without 'sleep'. This will cause your UI to hang. Are you using 'asleep' by mistake?`,
);
if (safetyEnabled) {
const now = performance.now();
if (now - workerScript.infiniteLoopSafety > CONSTANTS.InfiniteLoopLimit) {
throw new Error(
`Potential infinite loop without sleep detected. The game spent ${CONSTANTS.InfiniteLoopLimit}ms stuck in this script. (Are you using 'asleep' by mistake?)`,
);
}
}
return func(ctx)(...args);
}
const parent = getNestedProperty(wrappedAPI, ...tree);

@ -114,7 +114,7 @@ export class WorkerScript {
/**
* Once this counter reaches it's limit the script crashes. It is reset when a promise completes.
*/
infiniteLoopSafetyCounter = 0;
infiniteLoopSafety = performance.now();
constructor(runningScriptObj: RunningScript, pid: number, nsFuncsGenerator?: (ws: WorkerScript) => any) {
this.name = runningScriptObj.filename;

@ -14,7 +14,7 @@ export function netscriptDelay(time: number, workerScript: WorkerScript): Promis
workerScript.delay = null;
workerScript.delayReject = undefined;
workerScript.infiniteLoopSafetyCounter = 0;
workerScript.infiniteLoopSafety = performance.now();
if (workerScript.env.stopFlag) reject(new ScriptDeath(workerScript));
else resolve();
}, time);