fix(tracker): remove wworker logs(unused)

This commit is contained in:
sylenien 2022-06-22 12:49:46 +02:00
parent 22d7c4acd0
commit 794c7f72d4
3 changed files with 1 additions and 30 deletions

View file

@ -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 }>

View file

@ -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?

View file

@ -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<WorkerMessageData>) => {
}
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<WorkerMessageData>) => {
}
if (data.type === 'start') {
workerLogStatus = data.workerLog || WorkerActivityLogStatus.Off
workerStatus = WorkerStatus.Starting
sender = new QueueSender(
data.ingestPoint,