Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
ref: PR feedback
  • Loading branch information
mydea committed Dec 7, 2022
commit 37a81d658ba096c092cfd955f6cc9c5104cf8e1d
17 changes: 4 additions & 13 deletions packages/replay/src/replay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ export class ReplayContainer {
try {
this._stopRecording = record({
...this.recordingOptions,
...this._getRecordingOptionsOverwrites(),
// 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 @@ -1281,16 +1284,4 @@ export class ReplayContainer {

client.recordDroppedEvent = this._originalRecordDroppedEvent;
}

/** Additional recordingOptions that should take precedence over user config */
private _getRecordingOptionsOverwrites(): Partial<RecordingOptions> {
return this._waitForError
? {
// Checkout every minute, meaning we only get up-to one minute of events before the error happens
// 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
checkoutEveryNth: 60000,
}
: {};
}
}