fix: app raises port not available error (#2466)

This commit is contained in:
Louis 2024-03-22 17:53:33 +07:00 committed by GitHub
parent 254a79ccbe
commit 3c0383f6d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -84,7 +84,7 @@ function unloadModel(): Promise<any> {
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) => {