From 794c7f72d4778890b030bd406bd861d1144fb1e0 Mon Sep 17 00:00:00 2001 From: sylenien Date: Wed, 22 Jun 2022 12:49:46 +0200 Subject: [PATCH] fix(tracker): remove wworker logs(unused) --- tracker/tracker/src/common/webworker.ts | 9 --------- tracker/tracker/src/main/app/index.ts | 2 -- tracker/tracker/src/webworker/index.ts | 20 +------------------- 3 files changed, 1 insertion(+), 30 deletions(-) diff --git a/tracker/tracker/src/common/webworker.ts b/tracker/tracker/src/common/webworker.ts index bf3874960..3f6de9c35 100644 --- a/tracker/tracker/src/common/webworker.ts +++ b/tracker/tracker/src/common/webworker.ts @@ -1,7 +1,6 @@ export interface Options { connAttemptCount?: number connAttemptGap?: number - workerLog?: WorkerActivityLogStatus } type Start = { @@ -17,12 +16,4 @@ type Auth = { beaconSizeLimit?: number } -export enum WorkerActivityLogStatus { - Off, - Console, - Error, - ErrorWithData, -} - - export type WorkerMessageData = null | "stop" | Start | Auth | Array<{ _id: number }> diff --git a/tracker/tracker/src/main/app/index.ts b/tracker/tracker/src/main/app/index.ts index ea962e3bb..478f7d8fe 100644 --- a/tracker/tracker/src/main/app/index.ts +++ b/tracker/tracker/src/main/app/index.ts @@ -120,7 +120,6 @@ export default class App { __debug_report_edp: null, localStorage: window.localStorage, sessionStorage: window.sessionStorage, - workerLog: WorkerActivityLogStatus.Off, }, options, ); @@ -352,7 +351,6 @@ export default class App { timestamp: startInfo.timestamp, connAttemptCount: this.options.connAttemptCount, connAttemptGap: this.options.connAttemptGap, - workerLog: this.options.workerLog, } this.worker.postMessage(startWorkerMsg) // brings delay of 10th ms? diff --git a/tracker/tracker/src/webworker/index.ts b/tracker/tracker/src/webworker/index.ts index 76fd333e7..7d1cb0393 100644 --- a/tracker/tracker/src/webworker/index.ts +++ b/tracker/tracker/src/webworker/index.ts @@ -1,5 +1,5 @@ import type Message from "../common/messages.js"; -import { WorkerMessageData, WorkerActivityLogStatus } from "../common/webworker.js"; +import { WorkerMessageData } from "../common/webworker.js"; import { classes, @@ -21,7 +21,6 @@ const AUTO_SEND_INTERVAL = 10 * 1000 let sender: QueueSender | null = null let writer: BatchWriter | null = null let workerStatus: WorkerStatus = WorkerStatus.NotActive; -let workerLogStatus: WorkerActivityLogStatus = WorkerActivityLogStatus.Off; function send(): void { if (!writer) { @@ -67,22 +66,6 @@ self.onmessage = ({ data }: MessageEvent) => { } if (Array.isArray(data)) { - if (workerStatus !== WorkerStatus.Active) { - if (workerLogStatus !== WorkerActivityLogStatus.Off) { - const msg = 'WebWorker: trying to send data without writer' - switch (workerLogStatus) { - case WorkerActivityLogStatus.Console: - return console.error(msg, 'STATUS:', workerStatus, data) - case WorkerActivityLogStatus.Error: - throw new Error(msg + '----- STATUS:' + workerStatus); - case WorkerActivityLogStatus.ErrorWithData: - throw new Error(msg + '----- STATUS:' + workerStatus + JSON.stringify(data)) - default: - return; - } - } - return; - } if (!writer) { throw new Error("WebWorker: writer not initialised. Service Should be Started.") } @@ -104,7 +87,6 @@ self.onmessage = ({ data }: MessageEvent) => { } if (data.type === 'start') { - workerLogStatus = data.workerLog || WorkerActivityLogStatus.Off workerStatus = WorkerStatus.Starting sender = new QueueSender( data.ingestPoint,