@@ -6,7 +6,6 @@ import { logger } from '@sentry/utils';
66
77import {
88 BUFFER_CHECKOUT_TIME ,
9- MAX_SESSION_LIFE ,
109 SESSION_IDLE_EXPIRE_DURATION ,
1110 SESSION_IDLE_PAUSE_DURATION ,
1211 SLOW_CLICK_SCROLL_TIMEOUT ,
@@ -148,7 +147,6 @@ export class ReplayContainer implements ReplayContainerInterface {
148147 this . timeouts = {
149148 sessionIdlePause : SESSION_IDLE_PAUSE_DURATION ,
150149 sessionIdleExpire : SESSION_IDLE_EXPIRE_DURATION ,
151- maxSessionLife : MAX_SESSION_LIFE ,
152150 } as const ;
153151 this . _lastActivity = Date . now ( ) ;
154152 this . _isEnabled = false ;
@@ -278,14 +276,10 @@ export class ReplayContainer implements ReplayContainerInterface {
278276
279277 const previousSessionId = this . session && this . session . id ;
280278
281- const { session } = getSession ( {
282- timeouts : this . timeouts ,
283- stickySession : Boolean ( this . _options . stickySession ) ,
284- currentSession : this . session ,
279+ const { session } = getSession ( this , {
285280 // This is intentional: create a new session-based replay when calling `start()`
286281 sessionSampleRate : 1 ,
287282 allowBuffering : false ,
288- traceInternals : this . _options . _experiments . traceInternals ,
289283 } ) ;
290284
291285 session . previousSessionId = previousSessionId ;
@@ -307,13 +301,9 @@ export class ReplayContainer implements ReplayContainerInterface {
307301
308302 const previousSessionId = this . session && this . session . id ;
309303
310- const { session } = getSession ( {
311- timeouts : this . timeouts ,
312- stickySession : Boolean ( this . _options . stickySession ) ,
313- currentSession : this . session ,
304+ const { session } = getSession ( this , {
314305 sessionSampleRate : 0 ,
315306 allowBuffering : true ,
316- traceInternals : this . _options . _experiments . traceInternals ,
317307 } ) ;
318308
319309 session . previousSessionId = previousSessionId ;
@@ -483,7 +473,7 @@ export class ReplayContainer implements ReplayContainerInterface {
483473 // `shouldRefresh`, the session could be considered expired due to
484474 // lifespan, which is not what we want. Update session start date to be
485475 // the current timestamp, so that session is not considered to be
486- // expired. This means that max replay duration can be MAX_SESSION_LIFE +
476+ // expired. This means that max replay duration can be MAX_REPLAY_DURATION +
487477 // (length of buffer), which we are ok with.
488478 this . _updateUserActivity ( activityTime ) ;
489479 this . _updateSessionActivity ( activityTime ) ;
@@ -754,13 +744,9 @@ export class ReplayContainer implements ReplayContainerInterface {
754744 * Returns false if session is not recorded.
755745 */
756746 private _loadAndCheckSession ( ) : boolean {
757- const { type, session } = getSession ( {
758- timeouts : this . timeouts ,
759- stickySession : Boolean ( this . _options . stickySession ) ,
760- currentSession : this . session ,
747+ const { type, session } = getSession ( this , {
761748 sessionSampleRate : this . _options . sessionSampleRate ,
762749 allowBuffering : this . _options . errorSampleRate > 0 || this . recordingMode === 'buffer' ,
763- traceInternals : this . _options . _experiments . traceInternals ,
764750 } ) ;
765751
766752 // If session was newly created (i.e. was not loaded from storage), then
@@ -893,7 +879,10 @@ export class ReplayContainer implements ReplayContainerInterface {
893879 return ;
894880 }
895881
896- const expired = isSessionExpired ( this . session , this . timeouts ) ;
882+ const expired = isSessionExpired ( this . session , {
883+ maxReplayDuration : this . _options . maxReplayDuration ,
884+ ...this . timeouts ,
885+ } ) ;
897886
898887 if ( breadcrumb && ! expired ) {
899888 this . _createCustomBreadcrumb ( breadcrumb ) ;
@@ -1136,10 +1125,10 @@ export class ReplayContainer implements ReplayContainerInterface {
11361125 // A flush is about to happen, cancel any queued flushes
11371126 this . _debouncedFlush . cancel ( ) ;
11381127
1139- // If session is too short, or too long (allow some wiggle room over maxSessionLife ), do not send it
1128+ // If session is too short, or too long (allow some wiggle room over maxReplayDuration ), do not send it
11401129 // This _should_ not happen, but it may happen if flush is triggered due to a page activity change or similar
11411130 const tooShort = duration < this . _options . minReplayDuration ;
1142- const tooLong = duration > this . timeouts . maxSessionLife + 5_000 ;
1131+ const tooLong = duration > this . _options . maxReplayDuration + 5_000 ;
11431132 if ( tooShort || tooLong ) {
11441133 logInfo (
11451134 `[Replay] Session duration (${ Math . floor ( duration / 1000 ) } s) is too ${
0 commit comments