fix sleeve memory bug

This commit is contained in:
Olivier Gagnon
2021-09-08 23:47:34 -04:00
parent bada8a5f39
commit 2a13db39c7
360 changed files with 5424 additions and 15764 deletions
+4 -15
View File
@@ -106,11 +106,7 @@ export class WorkerScript {
*/
serverIp: string;
constructor(
runningScriptObj: RunningScript,
pid: number,
nsFuncsGenerator?: (ws: WorkerScript) => any,
) {
constructor(runningScriptObj: RunningScript, pid: number, nsFuncsGenerator?: (ws: WorkerScript) => any) {
this.name = runningScriptObj.filename;
this.serverIp = runningScriptObj.server;
@@ -124,9 +120,7 @@ export class WorkerScript {
// Get the underlying script's code
const server = AllServers[this.serverIp];
if (server == null) {
throw new Error(
`WorkerScript constructed with invalid server ip: ${this.serverIp}`,
);
throw new Error(`WorkerScript constructed with invalid server ip: ${this.serverIp}`);
}
let found = false;
for (let i = 0; i < server.scripts.length; ++i) {
@@ -136,9 +130,7 @@ export class WorkerScript {
}
}
if (!found) {
throw new Error(
`WorkerScript constructed with invalid script filename: ${this.name}`,
);
throw new Error(`WorkerScript constructed with invalid script filename: ${this.name}`);
}
this.env = new Environment(null);
@@ -156,10 +148,7 @@ export class WorkerScript {
*/
getServer(): BaseServer {
const server = AllServers[this.serverIp];
if (server == null)
throw new Error(
`Script ${this.name} pid ${this.pid} is running on non-existent server?`,
);
if (server == null) throw new Error(`Script ${this.name} pid ${this.pid} is running on non-existent server?`);
return server;
}