From 3c0383f6d8c3367b6f2fd5fcd6ea925c97cff750 Mon Sep 17 00:00:00 2001 From: Louis Date: Fri, 22 Mar 2024 17:53:33 +0700 Subject: [PATCH] fix: app raises port not available error (#2466) --- extensions/tensorrt-llm-extension/src/node/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/extensions/tensorrt-llm-extension/src/node/index.ts b/extensions/tensorrt-llm-extension/src/node/index.ts index 4e2a7b9fa..4dad464da 100644 --- a/extensions/tensorrt-llm-extension/src/node/index.ts +++ b/extensions/tensorrt-llm-extension/src/node/index.ts @@ -84,7 +84,7 @@ function unloadModel(): Promise { debugLog( `Could not kill running process on port ${ENGINE_PORT}. Might be another process running on the same port? ${err}` ) - throw 'PORT_NOT_AVAILABLE' + return { err: 'PORT_NOT_AVAILABLE' } }) } /** @@ -97,6 +97,11 @@ async function runEngineAndLoadModel( systemInfo: SystemInformation ) { return unloadModel() + .then((res) => { + if (res?.error) { + throw new Error(res.error) + } + }) .then(() => runEngine(systemInfo)) .then(() => loadModelRequest(settings)) .catch((err) => {