From 716ea13da86f2957c5534702c01bc6ddcea3095a Mon Sep 17 00:00:00 2001 From: marknguyen1302 Date: Fri, 21 Jun 2024 12:01:15 +0700 Subject: [PATCH] fix: add telemetry timeout, remove debug log --- cortex-js/src/infrastructure/constants/cortex.ts | 2 +- .../repositories/telemetry/telemetry.repository.ts | 1 + .../services/file-manager/file-manager.service.ts | 5 ++--- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cortex-js/src/infrastructure/constants/cortex.ts b/cortex-js/src/infrastructure/constants/cortex.ts index 7d458da59..bc2d91064 100644 --- a/cortex-js/src/infrastructure/constants/cortex.ts +++ b/cortex-js/src/infrastructure/constants/cortex.ts @@ -48,4 +48,4 @@ export const CORTEX_ONNX_ENGINE_RELEASES_URL = export const CUDA_DOWNLOAD_URL = 'https://catalog.jan.ai/dist/cuda-dependencies///cuda.tar.gz'; -export const telemetryServerUrl = 'http://192.168.100.30:1338/'; +export const telemetryServerUrl = 'http://192.168.100.30:1338'; diff --git a/cortex-js/src/infrastructure/repositories/telemetry/telemetry.repository.ts b/cortex-js/src/infrastructure/repositories/telemetry/telemetry.repository.ts index fe5be3be5..b20562d96 100644 --- a/cortex-js/src/infrastructure/repositories/telemetry/telemetry.repository.ts +++ b/cortex-js/src/infrastructure/repositories/telemetry/telemetry.repository.ts @@ -55,6 +55,7 @@ export class TelemetryRepositoryImpl implements TelemetryRepository { 'Content-Type': 'application/json', 'cortex-checksum': this.generateChecksum(telemetry.event), }, + timeout: 1000, }, ); } catch (error) {} diff --git a/cortex-js/src/infrastructure/services/file-manager/file-manager.service.ts b/cortex-js/src/infrastructure/services/file-manager/file-manager.service.ts index 09faef48e..a7243b0da 100644 --- a/cortex-js/src/infrastructure/services/file-manager/file-manager.service.ts +++ b/cortex-js/src/infrastructure/services/file-manager/file-manager.service.ts @@ -151,7 +151,7 @@ export class FileManagerService { return await readPreviousChunk(); } catch (err) { - console.error('Error reading last line:', err); + //todo: add log level then log error throw err; } } @@ -162,7 +162,7 @@ export class FileManagerService { await writeAsync(fd, buffer, 0, buffer.length, position); await closeAsync(fd); } catch (err) { - console.error('Error modifying last line:', err); + //todo: add log level then log error throw err; } } @@ -179,7 +179,6 @@ export class FileManagerService { }, ); } catch (err) { - console.error('Error appending to file:', err); throw err; } }