Update extensions/inference-nitro-extension/src/module.ts

Co-authored-by: Louis <louis@jan.ai>
This commit is contained in:
hiro 2023-12-13 16:40:56 +07:00 committed by GitHub
parent 539f11e583
commit 96fa392fba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -189,14 +189,14 @@ async function validateModelStatus(): Promise<ModelOperationResponse> {
*/
function killSubprocess(): Promise<void> {
if (subprocess) {
fetch(NITRO_HTTP_KILL_URL, {
return fetch(NITRO_HTTP_KILL_URL, {
method: "DELETE",
}).catch((err) => {
console.error(err);
subprocess.kill();
subprocess = null;
return killSubprocess();
});
return kill(PORT, "tcp").then(console.log).catch(console.log);
});
} else {
return kill(PORT, "tcp").then(console.log).catch(console.log);
}