Fixed client disconnect and navigation glitch

This commit is contained in:
Dunemask 2022-08-14 19:23:37 +00:00
parent ecf0516b39
commit a3cb448a7b
8 changed files with 34 additions and 39 deletions

View file

@ -1,4 +1,4 @@
import { Manager } from "socket.io-client";
import io from "socket.io-client";
import cp from "child_process";
import modes from "../modes.js";
@ -46,10 +46,9 @@ export default class Executor {
}
runJob() {
const mgr = new Manager(this.url, {
this.socket = io(this.url, {
query: { mode: this.mode, jobId: this.jobId },
});
this.socket = mgr.socket("/");
this.socket.on("connect", this.spawn);
this.socket.on("disconnect", this.onClose);
}
@ -57,7 +56,6 @@ export default class Executor {
onClose() {
console.log("Server disconnected, terminating process.");
if (this.proc) this.proc.kill("SIGKILL");
}
onProcClose(code) {