increase perfomance ticker and remove empty batches

This commit is contained in:
Андрей Бабушкин 2025-03-25 14:44:09 +01:00 committed by nick-delirium
parent 999e5cba3a
commit 8ecc67c745
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0
2 changed files with 12 additions and 1 deletions

View file

@ -272,6 +272,7 @@ export default class App {
'feature-flags': true,
'usability-test': true,
}
private emptyBatchCounter = 0
constructor(
projectKey: string,
@ -872,6 +873,16 @@ export default class App {
return
}
if (!this.messages.length) {
if (this.emptyBatchCounter < 1000) {
this.emptyBatchCounter++;
return;
}
}
this.emptyBatchCounter = 0
console.log('messages', this.messages.join(', '))
try {
requestIdleCb(() => {
this.messages.unshift(TabData(this.session.getTabId()))

View file

@ -80,7 +80,7 @@ export default function (app: App, opts: Partial<Options>): void {
ticks = frames = undefined
})
app.ticker.attach(sendPerformanceTrack, 40, false)
app.ticker.attach(sendPerformanceTrack, 165, false)
if (document.hidden !== undefined) {
app.attachEventListener(