@tracelog/lib 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/tracelog.esm.js +32 -26
- package/dist/browser/tracelog.esm.js.map +1 -1
- package/dist/browser/tracelog.js +1 -1
- package/dist/browser/tracelog.js.map +1 -1
- package/dist/public-api.cjs +38 -32
- package/dist/public-api.cjs.map +1 -1
- package/dist/public-api.d.mts +1 -0
- package/dist/public-api.d.ts +1 -0
- package/dist/public-api.js +38 -32
- package/dist/public-api.js.map +1 -1
- package/package.json +1 -1
package/dist/public-api.d.mts
CHANGED
|
@@ -1244,6 +1244,7 @@ declare class EventManager extends StateManager {
|
|
|
1244
1244
|
private eventsQueue;
|
|
1245
1245
|
private pendingEventsBuffer;
|
|
1246
1246
|
private sendIntervalId;
|
|
1247
|
+
private sendInProgress;
|
|
1247
1248
|
private rateLimitCounter;
|
|
1248
1249
|
private rateLimitWindowStart;
|
|
1249
1250
|
private lastSessionId;
|
package/dist/public-api.d.ts
CHANGED
|
@@ -1244,6 +1244,7 @@ declare class EventManager extends StateManager {
|
|
|
1244
1244
|
private eventsQueue;
|
|
1245
1245
|
private pendingEventsBuffer;
|
|
1246
1246
|
private sendIntervalId;
|
|
1247
|
+
private sendInProgress;
|
|
1247
1248
|
private rateLimitCounter;
|
|
1248
1249
|
private rateLimitWindowStart;
|
|
1249
1250
|
private lastSessionId;
|
package/dist/public-api.js
CHANGED
|
@@ -555,7 +555,7 @@ var LONG_TASK_THROTTLE_MS = 1e3;
|
|
|
555
555
|
var MAX_NAVIGATION_HISTORY = 50;
|
|
556
556
|
|
|
557
557
|
// package.json
|
|
558
|
-
var version = "2.
|
|
558
|
+
var version = "2.3.0";
|
|
559
559
|
|
|
560
560
|
// src/constants/version.constants.ts
|
|
561
561
|
var LIB_VERSION = version;
|
|
@@ -2533,6 +2533,7 @@ var EventManager = class extends StateManager {
|
|
|
2533
2533
|
eventsQueue = [];
|
|
2534
2534
|
pendingEventsBuffer = [];
|
|
2535
2535
|
sendIntervalId = null;
|
|
2536
|
+
sendInProgress = false;
|
|
2536
2537
|
rateLimitCounter = 0;
|
|
2537
2538
|
rateLimitWindowStart = 0;
|
|
2538
2539
|
lastSessionId = null;
|
|
@@ -3181,42 +3182,47 @@ var EventManager = class extends StateManager {
|
|
|
3181
3182
|
}
|
|
3182
3183
|
}
|
|
3183
3184
|
async sendEventsQueue() {
|
|
3184
|
-
if (!this.get("sessionId") || this.eventsQueue.length === 0) {
|
|
3185
|
+
if (!this.get("sessionId") || this.eventsQueue.length === 0 || this.sendInProgress) {
|
|
3185
3186
|
return;
|
|
3186
3187
|
}
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
this.
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3188
|
+
this.sendInProgress = true;
|
|
3189
|
+
try {
|
|
3190
|
+
const body = this.buildEventsPayload();
|
|
3191
|
+
if (this.dataSenders.length === 0) {
|
|
3192
|
+
this.emitEventsQueue(body);
|
|
3193
|
+
return;
|
|
3194
|
+
}
|
|
3195
|
+
const eventsToSend = [...this.eventsQueue];
|
|
3196
|
+
const eventIds = eventsToSend.map((e) => e.id);
|
|
3197
|
+
const sendPromises = this.dataSenders.map(
|
|
3198
|
+
async (sender) => sender.sendEventsQueue(body, {
|
|
3199
|
+
onSuccess: () => {
|
|
3200
|
+
},
|
|
3201
|
+
onFailure: () => {
|
|
3202
|
+
}
|
|
3203
|
+
})
|
|
3204
|
+
);
|
|
3205
|
+
const results = await Promise.allSettled(sendPromises);
|
|
3206
|
+
const anySucceeded = results.some((result) => this.isSuccessfulResult(result));
|
|
3207
|
+
if (anySucceeded) {
|
|
3208
|
+
this.removeProcessedEvents(eventIds);
|
|
3209
|
+
this.emitEventsQueue(body);
|
|
3210
|
+
const failedCount = results.filter((result) => !this.isSuccessfulResult(result)).length;
|
|
3211
|
+
if (failedCount > 0) {
|
|
3212
|
+
log("debug", "Periodic send completed with some failures, removed from queue and persisted per-integration", {
|
|
3213
|
+
data: { eventCount: eventsToSend.length, failedCount }
|
|
3214
|
+
});
|
|
3199
3215
|
}
|
|
3200
|
-
}
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
const anySucceeded = results.some((result) => this.isSuccessfulResult(result));
|
|
3204
|
-
if (anySucceeded) {
|
|
3205
|
-
this.removeProcessedEvents(eventIds);
|
|
3206
|
-
this.emitEventsQueue(body);
|
|
3207
|
-
const failedCount = results.filter((result) => !this.isSuccessfulResult(result)).length;
|
|
3208
|
-
if (failedCount > 0) {
|
|
3209
|
-
log("debug", "Periodic send completed with some failures, removed from queue and persisted per-integration", {
|
|
3210
|
-
data: { eventCount: eventsToSend.length, failedCount }
|
|
3216
|
+
} else {
|
|
3217
|
+
log("debug", "Periodic send complete failure, events kept in queue for retry", {
|
|
3218
|
+
data: { eventCount: eventsToSend.length }
|
|
3211
3219
|
});
|
|
3212
3220
|
}
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
if (this.eventsQueue.length === 0) {
|
|
3219
|
-
this.clearSendInterval();
|
|
3221
|
+
if (this.eventsQueue.length === 0) {
|
|
3222
|
+
this.clearSendInterval();
|
|
3223
|
+
}
|
|
3224
|
+
} finally {
|
|
3225
|
+
this.sendInProgress = false;
|
|
3220
3226
|
}
|
|
3221
3227
|
}
|
|
3222
3228
|
buildEventsPayload() {
|