feat(tracker): method to force send all remaining messages
This commit is contained in:
parent
efd562321e
commit
be55064786
4 changed files with 16 additions and 0 deletions
|
|
@ -28,6 +28,7 @@ export type ToWorkerData =
|
|||
| Array<Message>
|
||||
| { type: 'compressed'; batch: Uint8Array }
|
||||
| { type: 'uncompressed'; batch: Uint8Array }
|
||||
| 'forceFlushBatch'
|
||||
|
||||
type Failure = {
|
||||
type: 'failure'
|
||||
|
|
|
|||
|
|
@ -662,6 +662,10 @@ export default class App {
|
|||
}
|
||||
}
|
||||
|
||||
forceFlushBatch() {
|
||||
this.worker?.postMessage('forceFlushBatch')
|
||||
}
|
||||
|
||||
getTabId() {
|
||||
return this.session.getTabId()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -242,6 +242,13 @@ export default class API {
|
|||
return this.app.session.getSessionHash()
|
||||
}
|
||||
|
||||
forceFlushBatch() {
|
||||
if (this.app === null) {
|
||||
return
|
||||
}
|
||||
this.app.forceFlushBatch()
|
||||
}
|
||||
|
||||
getSessionToken(): string | null | undefined {
|
||||
if (this.app === null) {
|
||||
return null
|
||||
|
|
|
|||
|
|
@ -86,6 +86,10 @@ self.onmessage = ({ data }: { data: ToWorkerData }): any => {
|
|||
reset()
|
||||
return (workerStatus = WorkerStatus.Stopped)
|
||||
}
|
||||
if (data === 'forceFlushBatch') {
|
||||
finalize()
|
||||
return
|
||||
}
|
||||
|
||||
if (Array.isArray(data)) {
|
||||
if (writer !== null) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue