Skip to content

Commit b753b5d

Browse files
committed
fix(replay): Avoid infinite loop of logs
When using `_experiments.traceInternals`, this could lead to an infinite loop, as we run this check when a breadcrumb is added, and we add this breadcrumb in the check, ...
1 parent c1c9ffc commit b753b5d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/replay-internal/src/util/addEvent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { logger } from '@sentry/utils';
55
import { DEBUG_BUILD } from '../debug-build';
66
import { EventBufferSizeExceededError } from '../eventBuffer/error';
77
import type { AddEventResult, RecordingEvent, ReplayContainer, ReplayFrameEvent, ReplayPluginOptions } from '../types';
8-
import { logInfo } from './log';
8+
import { logInfoNextTick } from './log';
99
import { timestampToMs } from './timestamp';
1010

1111
function isCustomEvent(event: RecordingEvent): event is ReplayFrameEvent {
@@ -109,7 +109,7 @@ export function shouldAddEvent(replay: ReplayContainer, event: RecordingEvent):
109109

110110
// Throw out events that are +60min from the initial timestamp
111111
if (timestampInMs > replay.getContext().initialTimestamp + replay.getOptions().maxReplayDuration) {
112-
logInfo(
112+
logInfoNextTick(
113113
`[Replay] Skipping event with timestamp ${timestampInMs} because it is after maxReplayDuration`,
114114
replay.getOptions()._experiments.traceInternals,
115115
);

0 commit comments

Comments
 (0)