NETSCRIPT: Rework script ram updates (#408)

This commit is contained in:
Snarling
2023-03-05 22:39:42 -05:00
committed by GitHub
parent 14aafbe0a3
commit 759f86d6e5
24 changed files with 171 additions and 177 deletions
+3 -2
View File
@@ -272,7 +272,8 @@ export abstract class BaseServer {
if (fn === this.scripts[i].filename) {
const script = this.scripts[i];
script.code = code;
script.updateRamUsage(this.scripts);
// Set ramUsage to null in order to force recalculation on next run
script.ramUsage = null;
script.markUpdated();
ret.overwritten = true;
ret.success = true;
@@ -281,7 +282,7 @@ export abstract class BaseServer {
}
// Otherwise, create a new script
const newScript = new Script(fn, code, this.hostname, this.scripts);
const newScript = new Script(fn, code, this.hostname);
this.scripts.push(newScript);
ret.success = true;
return ret;