Skip to content

Commit

Permalink
fix: 4155 - Queue up health check on server restarting
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jan committed Dec 3, 2024
1 parent d9313d6 commit fb0a916
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions extensions/inference-cortex-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit fb0a916

Please sign in to comment.