From bd850fb3571fd3c45320254a84737852d839c5cc Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 19 Nov 2024 12:37:41 +0700 Subject: [PATCH] chore: reduce destroy attempts --- extensions/inference-cortex-extension/bin/version.txt | 2 +- extensions/inference-cortex-extension/src/index.ts | 8 ++++++-- extensions/model-extension/src/cortex.ts | 5 +++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/extensions/inference-cortex-extension/bin/version.txt b/extensions/inference-cortex-extension/bin/version.txt index 89f843d1d..b26ebdeac 100644 --- a/extensions/inference-cortex-extension/bin/version.txt +++ b/extensions/inference-cortex-extension/bin/version.txt @@ -1 +1 @@ -1.0.3-rc1 \ No newline at end of file +1.0.3-rc2 \ No newline at end of file diff --git a/extensions/inference-cortex-extension/src/index.ts b/extensions/inference-cortex-extension/src/index.ts index 1fb78c13e..8236d7de4 100644 --- a/extensions/inference-cortex-extension/src/index.ts +++ b/extensions/inference-cortex-extension/src/index.ts @@ -69,11 +69,11 @@ export default class JanInferenceCortexExtension extends LocalOAIEngine { super.onLoad() + await this.queue.add(() => this.clean()) this.queue.add(() => this.healthz()) this.queue.add(() => this.setDefaultEngine(systemInfo)) // Run the process watchdog const systemInfo = await systemInformation() - await this.clean() await executeOnMain(NODE, 'run', systemInfo) this.subscribeToEvents() @@ -160,7 +160,8 @@ export default class JanInferenceCortexExtension extends LocalOAIEngine { return ky .get(`${CORTEX_API_URL}/healthz`, { retry: { - limit: 10, + limit: 20, + delay: () => 500, methods: ['get'], }, }) @@ -192,6 +193,9 @@ export default class JanInferenceCortexExtension extends LocalOAIEngine { return ky .delete(`${CORTEX_API_URL}/processmanager/destroy`, { timeout: 2000, // maximum 2 seconds + retry: { + limit: 0, + }, }) .catch(() => { // Do nothing diff --git a/extensions/model-extension/src/cortex.ts b/extensions/model-extension/src/cortex.ts index 7a65e8e3f..f81cda553 100644 --- a/extensions/model-extension/src/cortex.ts +++ b/extensions/model-extension/src/cortex.ts @@ -1,6 +1,6 @@ import PQueue from 'p-queue' import ky from 'ky' -import { extractModelLoadParams, Model } from '@janhq/core' +import { extractModelLoadParams, Model } from '@janhq/core' import { extractInferenceParams } from '@janhq/core' /** * cortex.cpp Model APIs interface @@ -155,7 +155,8 @@ export class CortexAPI implements ICortexAPI { return ky .get(`${API_URL}/healthz`, { retry: { - limit: 10, + limit: 20, + delay: () => 500, methods: ['get'], }, })