Skip to content

Commit 88e9418

Browse files
authored
fix(replay): Cancel debounce when replay is too short/long (#8742)
Not sure if this has an impact, but it makes sense to cancel debounce anyhow in the case where we are too long/short. When we are too short, we schedule a new flush anyhow.
1 parent f7d37a0 commit 88e9418

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/replay/src/replay.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,9 @@ export class ReplayContainer implements ReplayContainerInterface {
11301130
const now = Date.now();
11311131
const duration = now - start;
11321132

1133+
// A flush is about to happen, cancel any queued flushes
1134+
this._debouncedFlush.cancel();
1135+
11331136
// If session is too short, or too long (allow some wiggle room over maxSessionLife), do not send it
11341137
// This _should_ not happen, but it may happen if flush is triggered due to a page activity change or similar
11351138
const tooShort = duration < this._options.minReplayDuration;
@@ -1148,9 +1151,6 @@ export class ReplayContainer implements ReplayContainerInterface {
11481151
return;
11491152
}
11501153

1151-
// A flush is about to happen, cancel any queued flushes
1152-
this._debouncedFlush.cancel();
1153-
11541154
// this._flushLock acts as a lock so that future calls to `_flush()`
11551155
// will be blocked until this promise resolves
11561156
if (!this._flushLock) {

0 commit comments

Comments
 (0)