Skip to content

Commit

Permalink
Merge pull request #4201 from janhq/fix/4155-queue-up-health-check-on…
Browse files Browse the repository at this point in the history
…-server-restart

fix: 4155 - Queue up health check on server restarting
  • Loading branch information
louis-jan authored Dec 3, 2024
2 parents 57d31bc + fb0a916 commit 9e634c7
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 9e634c7

Please sign in to comment.