Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/replay/src/replay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ export class ReplayContainer {
// when an error will occur, so we need to keep a buffer of
// replay events.
if (this.session.sampled === 'error') {
// Checkout every minute, meaning we only get up-to one minute of events before the error happens
this.recordingOptions.checkoutEveryNms = 60000;
this._waitForError = true;
}

Expand Down Expand Up @@ -187,6 +185,10 @@ export class ReplayContainer {
try {
this._stopRecording = record({
...this.recordingOptions,
// When running in error sampling mode, we need to overwrite `checkoutEveryNth`
// 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._waitForError && { checkoutEveryNth: 60000 }),
emit: this.handleRecordingEmit,
});
} catch (err) {
Expand Down Expand Up @@ -470,7 +472,6 @@ export class ReplayContainer {
this._stopRecording();
// Reset all "capture on error" configuration before
// starting a new recording
delete this.recordingOptions.checkoutEveryNms;
this._waitForError = false;
this.startRecording();
}
Expand Down