fix: 4155 - Queue up health check on server restarting

This commit is contained in:
Louis 2024-12-03 16:17:46 +07:00
parent d9313d670a
commit fb0a916c50
No known key found for this signature in database
GPG Key ID: 44FA9F4D33C37DE2

View File

@ -334,13 +334,22 @@ export default class JanInferenceCortexExtension extends LocalOAIEngine {
}
})
/**
* This is to handle the server segfault issue
*/
this.socket.onclose = (event) => {
console.log('WebSocket closed:', event)
// Notify app to update model running state
events.emit(ModelEvent.OnModelStopped, {})
// Reconnect to the /events websocket
if (this.shouldReconnect) {
console.log(`Attempting to reconnect...`)
setTimeout(() => this.subscribeToEvents(), 1000)
}
// Queue up health check
this.queue.add(() => this.healthz())
}
resolve()