Dirty fix for available ram float errors

1MB added to available ram when checking if available is sufficient. All actual ram values in game are a multiple of 50MB so an extra 1MB can't ever allow additional script load to be ran.
This commit is contained in:
Snarling
2022-05-06 08:56:19 -04:00
parent b46718d188
commit 99a0337a14
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -532,7 +532,7 @@ function createAndAddWorkerScript(
const oneRamUsage = getRamUsageFromRunningScript(runningScriptObj);
const ramUsage = roundToTwo(oneRamUsage * threads);
const ramAvailable = server.maxRam - server.ramUsed;
if (ramUsage > ramAvailable) {
if (ramUsage > ramAvailable + 0.001) {
dialogBoxCreate(
`Not enough RAM to run script ${runningScriptObj.filename} with args ` +
`${arrayToString(runningScriptObj.args)}. This likely occurred because you re-loaded ` +
@@ -750,7 +750,7 @@ export function runScriptFromScript(
if (server.hasAdminRights == false) {
workerScript.log(caller, () => `You do not have root access on '${server.hostname}'`);
return 0;
} else if (ramUsage > ramAvailable) {
} else if (ramUsage > ramAvailable + 0.001) {
workerScript.log(
caller,
() =>