Skip to content

Commit

Permalink
fix(replay): Fix checkoutEveryNms (#6722)
Browse files Browse the repository at this point in the history
This was inadvertantly changed and was causing replays to have very long durations since it was waiting for 60k events before resetting buffer.

Fixes #6720
  • Loading branch information
billyvg committed Jan 11, 2023
1 parent 23dbd45 commit b250f9f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/replay/src/replay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,8 @@ export class ReplayContainer implements ReplayContainerInterface {
return;
}

// Modify recording options to checkoutEveryNthSecond if
// sampling for error replay. This is because we don't know
// when an error will occur, so we need to keep a buffer of
// replay events.
// If session is sampled for errors, then we need to set the recordingMode
// to 'error', which will configure recording with different options.
if (this.session.sampled === 'error') {
this.recordingMode = 'error';
}
Expand Down Expand Up @@ -211,10 +209,10 @@ export class ReplayContainer implements ReplayContainerInterface {
try {
this._stopRecording = record({
...this._recordingOptions,
// When running in error sampling mode, we need to overwrite `checkoutEveryNth`
// When running in error sampling mode, we need to overwrite `checkoutEveryNms`
// Without this, it would record forever, until an error happens, which we don't want
// instead, we'll always keep the last 60 seconds of replay before an error happened
...(this.recordingMode === 'error' && { checkoutEveryNth: 60000 }),
...(this.recordingMode === 'error' && { checkoutEveryNms: 60000 }),
emit: this.handleRecordingEmit,
});
} catch (err) {
Expand Down

0 comments on commit b250f9f

Please sign in to comment.