Skip to content

Commit

Permalink
fix: Kill nitro many times app onDispose
Browse files Browse the repository at this point in the history
  • Loading branch information
hiro-v committed Dec 13, 2023
1 parent 96fa392 commit 2570113
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions extensions/inference-nitro-extension/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,18 +188,15 @@ async function validateModelStatus(): Promise<ModelOperationResponse> {
* @returns A Promise that resolves when the subprocess is terminated successfully, or rejects with an error message if the subprocess fails to terminate.
*/
function killSubprocess(): Promise<void> {
if (subprocess) {
return fetch(NITRO_HTTP_KILL_URL, {
method: "DELETE",
}).catch((err) => {
console.error(err);
subprocess.kill();
subprocess = null;
return kill(PORT, "tcp").then(console.log).catch(console.log);
});
} else {
return kill(PORT, "tcp").then(console.log).catch(console.log);
}
fetch(NITRO_HTTP_KILL_URL, {
method: "DELETE",
}).catch((err) => {
console.error(err);
subprocess?.kill();
kill(PORT, "tcp").then(console.log).catch(console.log);
subprocess = null;
});
return
}

/**
Expand Down

0 comments on commit 2570113

Please sign in to comment.