chore: clean dangling process on exit and relaunch
This commit is contained in:
parent
24b7d64efc
commit
56e35df84d
@ -50,12 +50,18 @@ export default class JanInferenceCortexExtension extends LocalOAIEngine {
|
||||
|
||||
// Run the process watchdog
|
||||
const systemInfo = await systemInformation()
|
||||
await this.clean()
|
||||
await executeOnMain(NODE, 'run', systemInfo)
|
||||
|
||||
this.queue.add(() => this.healthz())
|
||||
|
||||
window.addEventListener('beforeunload', () => {
|
||||
this.clean()
|
||||
})
|
||||
}
|
||||
|
||||
onUnload(): void {
|
||||
this.clean()
|
||||
executeOnMain(NODE, 'dispose')
|
||||
super.onUnload()
|
||||
}
|
||||
@ -132,6 +138,20 @@ export default class JanInferenceCortexExtension extends LocalOAIEngine {
|
||||
})
|
||||
.then(() => {})
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean cortex processes
|
||||
* @returns
|
||||
*/
|
||||
clean(): Promise<any> {
|
||||
return ky
|
||||
.delete(`${CORTEX_API_URL}/processmanager/destroy`, {
|
||||
timeout: 2000, // maximum 2 seconds
|
||||
})
|
||||
.catch(() => {
|
||||
// Do nothing
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// Legacy
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user