Skip to content

Commit 1f1e758

Browse files
committed
fix(performance): correct transaction length reference and update batch sending method to use setTimeout
1 parent 677fdaf commit 1f1e758

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

example/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ <h2>Test Vue integration: &lt;test-component&gt;</h2>
450450
if (message.catcherType === 'performance') {
451451
lastBatchTime = new Date();
452452
document.getElementById('batchStats').textContent =
453-
`Last batch sent: ${lastBatchTime.toLocaleTimeString()} (${message.payload.length} transactions)`;
453+
`Last batch sent: ${lastBatchTime.toLocaleTimeString()} (${message.payload.transactions.length} transactions)`;
454454
}
455455
return originalSend.call(this, data);
456456
};

src/modules/performance/index.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export default class PerformanceMonitoring {
123123
public destroy(): void {
124124
// Clear batch sending timer
125125
if (this.batchTimeout !== null) {
126-
const clear = isBrowser ? window.clearInterval : clearInterval;
126+
const clear = isBrowser ? window.clearTimeout : clearTimeout;
127127

128128
clear(this.batchTimeout);
129129
this.batchTimeout = null;
@@ -170,8 +170,11 @@ export default class PerformanceMonitoring {
170170
* Schedule periodic batch sending of transactions
171171
*/
172172
private scheduleBatchSend(): void {
173-
// Устанавливаем интервал для последующих отправок
174-
this.batchTimeout = setInterval(() => void this.processSendQueue(), this.batchInterval);
173+
this.batchTimeout = setTimeout(() => {
174+
void this.processSendQueue();
175+
176+
this.scheduleBatchSend(); // Schedule next batch
177+
}, this.batchInterval);
175178
}
176179

177180
/**

0 commit comments

Comments
 (0)