diff --git a/third-party.md b/third-party.md index ac17bb869..fc7fea986 100644 --- a/third-party.md +++ b/third-party.md @@ -1,4 +1,4 @@ -## Licenses (as of March 24, 2023) +## Licenses (as of April 7, 2023), 2023) Below is the list of dependencies used in OpenReplay software. Licenses may change between versions, so please keep this up to date with every new library you use. @@ -117,3 +117,4 @@ Below is the list of dependencies used in OpenReplay software. Licenses may chan | html2canvas | MIT | JavaScript | | eget | MIT | Infrastructure | | @medv/finder | MIT | JavaScript | +| fflate | MIT | JavaScript | diff --git a/tracker/tracker/src/main/app/index.ts b/tracker/tracker/src/main/app/index.ts index 368f1a0ca..ffd760af0 100644 --- a/tracker/tracker/src/main/app/index.ts +++ b/tracker/tracker/src/main/app/index.ts @@ -173,7 +173,7 @@ export default class App { this.worker.onmessage = ({ data }: MessageEvent) => { if (data === 'restart') { this.stop(false) - this.start({}, true) + void this.start({}, true) } else if (data === 'not_init') { console.warn('WebWorker: writer not initialised. Restarting tracker') } else if (data.type === 'failure') { @@ -182,9 +182,7 @@ export default class App { } else if (data.type === 'compress') { const batch = data.batch const batchSize = batch.byteLength - console.log(batchSize) - // 1000 * 10 - if (batchSize > 1) { + if (batchSize > 1000 * 25) { gzip(data.batch, { mtime: 0 }, (err, result) => { if (err) console.error(err) // @ts-ignore @@ -217,6 +215,7 @@ export default class App { headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ context, + // @ts-ignore error: `${e}`, }), }) diff --git a/tracker/tracker/src/webworker/QueueSender.ts b/tracker/tracker/src/webworker/QueueSender.ts index 9e070b12c..7eff9c662 100644 --- a/tracker/tracker/src/webworker/QueueSender.ts +++ b/tracker/tracker/src/webworker/QueueSender.ts @@ -59,16 +59,18 @@ export default class QueueSender { private sendBatch(batch: Uint8Array, isCompressed?: boolean): void { this.busy = true - // @ts-ignore + const headers = { + Authorization: `Bearer ${this.token as string}`, + } as Record + + if (isCompressed) { + headers['Content-Encoding'] = 'gzip' + } + fetch(this.ingestURL, { body: batch, method: 'POST', - // @ts-ignore - headers: { - Authorization: `Bearer ${this.token as string}`, - //"Content-Type": "", - 'Content-Encoding': isCompressed ? 'gzip' : undefined, - }, + headers, keepalive: batch.length < KEEPALIVE_SIZE_LIMIT, }) .then((r: Record) => {