From b748e54437cc8eada79dedb581395e1630970639 Mon Sep 17 00:00:00 2001 From: TheEssem Date: Mon, 17 May 2021 15:39:22 -0500 Subject: [PATCH] Delete jobs when disconnecting from image servers --- utils/image.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/image.js b/utils/image.js index 166912d..ef5496c 100644 --- a/utils/image.js +++ b/utils/image.js @@ -97,7 +97,7 @@ exports.connect = (server) => { }); connection.once("close", () => { for (const uuid of Object.keys(jobs)) { - if (jobs[uuid].addr === connection.remoteAddress) jobs[uuid].event.emit("error", new Error("Job ended prematurely due to a closed connection; please run your image job again")); + if (jobs[uuid].addr === connection.remoteAddress) jobs[uuid].event.emit("error", "Job ended prematurely due to a closed connection; please run your image job again"); } }); this.connections.push(connection); @@ -111,6 +111,7 @@ exports.disconnect = async () => { } for (const uuid of Object.keys(jobs)) { jobs[uuid].event.emit("error", "Job ended prematurely (not really an error; just run your image job again)"); + delete jobs[uuid]; } this.connections = []; return;