chore: reduce destroy attempts

This commit is contained in:
Louis 2024-11-19 12:37:41 +07:00
parent 05019f7236
commit bd850fb357
No known key found for this signature in database
GPG Key ID: 44FA9F4D33C37DE2
3 changed files with 10 additions and 5 deletions

View File

@ -1 +1 @@
1.0.3-rc1 1.0.3-rc2

View File

@ -69,11 +69,11 @@ export default class JanInferenceCortexExtension extends LocalOAIEngine {
super.onLoad() super.onLoad()
await this.queue.add(() => this.clean())
this.queue.add(() => this.healthz()) this.queue.add(() => this.healthz())
this.queue.add(() => this.setDefaultEngine(systemInfo)) this.queue.add(() => this.setDefaultEngine(systemInfo))
// Run the process watchdog // Run the process watchdog
const systemInfo = await systemInformation() const systemInfo = await systemInformation()
await this.clean()
await executeOnMain(NODE, 'run', systemInfo) await executeOnMain(NODE, 'run', systemInfo)
this.subscribeToEvents() this.subscribeToEvents()
@ -160,7 +160,8 @@ export default class JanInferenceCortexExtension extends LocalOAIEngine {
return ky return ky
.get(`${CORTEX_API_URL}/healthz`, { .get(`${CORTEX_API_URL}/healthz`, {
retry: { retry: {
limit: 10, limit: 20,
delay: () => 500,
methods: ['get'], methods: ['get'],
}, },
}) })
@ -192,6 +193,9 @@ export default class JanInferenceCortexExtension extends LocalOAIEngine {
return ky return ky
.delete(`${CORTEX_API_URL}/processmanager/destroy`, { .delete(`${CORTEX_API_URL}/processmanager/destroy`, {
timeout: 2000, // maximum 2 seconds timeout: 2000, // maximum 2 seconds
retry: {
limit: 0,
},
}) })
.catch(() => { .catch(() => {
// Do nothing // Do nothing

View File

@ -1,6 +1,6 @@
import PQueue from 'p-queue' import PQueue from 'p-queue'
import ky from 'ky' import ky from 'ky'
import { extractModelLoadParams, Model } from '@janhq/core' import { extractModelLoadParams, Model } from '@janhq/core'
import { extractInferenceParams } from '@janhq/core' import { extractInferenceParams } from '@janhq/core'
/** /**
* cortex.cpp Model APIs interface * cortex.cpp Model APIs interface
@ -155,7 +155,8 @@ export class CortexAPI implements ICortexAPI {
return ky return ky
.get(`${API_URL}/healthz`, { .get(`${API_URL}/healthz`, {
retry: { retry: {
limit: 10, limit: 20,
delay: () => 500,
methods: ['get'], methods: ['get'],
}, },
}) })