Skip to content

Commit 37a81d6

Browse files
committed
ref: PR feedback
1 parent 65ef381 commit 37a81d6

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

packages/replay/src/replay.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,10 @@ export class ReplayContainer {
185185
try {
186186
this._stopRecording = record({
187187
...this.recordingOptions,
188-
...this._getRecordingOptionsOverwrites(),
188+
// When running in error sampling mode, we need to overwrite `checkoutEveryNth`
189+
// Without this, it would record forever, until an error happens, which we don't want
190+
// instead, we'll always keep the last 60 seconds of replay before an error happened
191+
...(this._waitForError && { checkoutEveryNth: 60000 }),
189192
emit: this.handleRecordingEmit,
190193
});
191194
} catch (err) {
@@ -1281,16 +1284,4 @@ export class ReplayContainer {
12811284

12821285
client.recordDroppedEvent = this._originalRecordDroppedEvent;
12831286
}
1284-
1285-
/** Additional recordingOptions that should take precedence over user config */
1286-
private _getRecordingOptionsOverwrites(): Partial<RecordingOptions> {
1287-
return this._waitForError
1288-
? {
1289-
// Checkout every minute, meaning we only get up-to one minute of events before the error happens
1290-
// Without this, it would record forever, until an error happens, which we don't want
1291-
// instead, we'll always keep the last 60 seconds of replay before an error happened
1292-
checkoutEveryNth: 60000,
1293-
}
1294-
: {};
1295-
}
12961287
}

0 commit comments

Comments
 (0)