fix(tracker): finaliseBatch for over-beaconSized messages

This commit is contained in:
Alex Kaminskii 2023-03-24 17:56:00 +01:00
parent 19872ee11d
commit 9e2839a5e4

View file

@ -117,11 +117,13 @@ export default class BatchWriter {
if (this.writeWithSize(message)) {
return
}
// buffer is too small. Create one with maximal capacity
// buffer is too small. Creating one with maximal capacity for this message only
this.encoder = new MessageEncoder(this.beaconSizeLimit)
this.prepare()
if (!this.writeWithSize(message)) {
console.warn('OpenReplay: beacon size overflow. Skipping large message.', message, this)
} else {
this.finaliseBatch()
}
// reset encoder to normal size
this.encoder = new MessageEncoder(this.beaconSize)