From fb0a916c50139cf4acca821940e6d6132f14eb3d Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 3 Dec 2024 16:17:46 +0700 Subject: [PATCH] fix: 4155 - Queue up health check on server restarting --- extensions/inference-cortex-extension/src/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/extensions/inference-cortex-extension/src/index.ts b/extensions/inference-cortex-extension/src/index.ts index 4e9ffd55a9..4cc322436d 100644 --- a/extensions/inference-cortex-extension/src/index.ts +++ b/extensions/inference-cortex-extension/src/index.ts @@ -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()