Skip to content

Commit db0d4f6

Browse files
committed
fix after rebase
1 parent c9d61d3 commit db0d4f6

File tree

6 files changed

+42
-15
lines changed

6 files changed

+42
-15
lines changed

packages/replay/src/replay.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ export class ReplayContainer implements ReplayContainerInterface {
275275
this.session,
276276
{
277277
timeouts: this.timeouts,
278+
maxReplayDuration: this._options.maxReplayDuration,
278279
traceInternals: this._options._experiments.traceInternals,
279280
},
280281
{
@@ -305,6 +306,7 @@ export class ReplayContainer implements ReplayContainerInterface {
305306
this.session,
306307
{
307308
timeouts: this.timeouts,
309+
maxReplayDuration: this._options.maxReplayDuration,
308310
traceInternals: this._options._experiments.traceInternals,
309311
},
310312
{
@@ -758,6 +760,7 @@ export class ReplayContainer implements ReplayContainerInterface {
758760
this.session,
759761
{
760762
timeouts: this.timeouts,
763+
maxReplayDuration: this._options.maxReplayDuration,
761764
traceInternals: this._options._experiments.traceInternals,
762765
},
763766
{
@@ -788,6 +791,7 @@ export class ReplayContainer implements ReplayContainerInterface {
788791
{
789792
timeouts: this.timeouts,
790793
traceInternals: this._options._experiments.traceInternals,
794+
maxReplayDuration: this._options.maxReplayDuration,
791795
},
792796
{
793797
stickySession: Boolean(this._options.stickySession),

packages/replay/src/session/loadOrCreateSession.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ export function loadOrCreateSession(
1313
{
1414
timeouts,
1515
traceInternals,
16+
maxReplayDuration,
1617
}: {
1718
timeouts: Timeouts;
19+
maxReplayDuration: number;
1820
traceInternals?: boolean;
1921
},
2022
sessionOptions: SessionOptions,
@@ -28,5 +30,5 @@ export function loadOrCreateSession(
2830
return createSession(sessionOptions);
2931
}
3032

31-
return maybeRefreshSession(existingSession, { timeouts, traceInternals }, sessionOptions);
33+
return maybeRefreshSession(existingSession, { timeouts, traceInternals, maxReplayDuration }, sessionOptions);
3234
}

packages/replay/src/session/maybeRefreshSession.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@ export function maybeRefreshSession(
1414
{
1515
timeouts,
1616
traceInternals,
17+
maxReplayDuration,
1718
}: {
1819
timeouts: Timeouts;
20+
maxReplayDuration: number;
1921
traceInternals?: boolean;
2022
},
2123
sessionOptions: SessionOptions,
2224
): Session {
2325
// If not expired, all good, just keep the session
24-
if (!isSessionExpired(session, timeouts)) {
26+
if (!isSessionExpired(session, { sessionIdleExpire: timeouts.sessionIdleExpire, maxReplayDuration })) {
2527
return session;
2628
}
2729

packages/replay/test/unit/session/loadOrCreateSession.test.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {
2-
MAX_SESSION_LIFE,
2+
MAX_REPLAY_DURATION,
33
SESSION_IDLE_EXPIRE_DURATION,
44
SESSION_IDLE_PAUSE_DURATION,
55
WINDOW,
@@ -27,7 +27,6 @@ const SAMPLE_OPTIONS: SessionOptions = {
2727
const timeouts: Timeouts = {
2828
sessionIdlePause: SESSION_IDLE_PAUSE_DURATION,
2929
sessionIdleExpire: SESSION_IDLE_EXPIRE_DURATION,
30-
maxSessionLife: MAX_SESSION_LIFE,
3130
};
3231

3332
function createMockSession(when: number = Date.now(), id = 'test_session_id') {
@@ -60,6 +59,7 @@ describe('Unit | session | loadOrCreateSession', () => {
6059
undefined,
6160
{
6261
timeouts,
62+
maxReplayDuration: MAX_REPLAY_DURATION,
6363
},
6464
{
6565
...SAMPLE_OPTIONS,
@@ -91,6 +91,7 @@ describe('Unit | session | loadOrCreateSession', () => {
9191
undefined,
9292
{
9393
timeouts: { ...timeouts, sessionIdleExpire: 1000 },
94+
maxReplayDuration: MAX_REPLAY_DURATION,
9495
},
9596
{
9697
...SAMPLE_OPTIONS,
@@ -122,6 +123,7 @@ describe('Unit | session | loadOrCreateSession', () => {
122123
currentSession,
123124
{
124125
timeouts,
126+
maxReplayDuration: MAX_REPLAY_DURATION,
125127
},
126128
{
127129
...SAMPLE_OPTIONS,
@@ -142,6 +144,7 @@ describe('Unit | session | loadOrCreateSession', () => {
142144
undefined,
143145
{
144146
timeouts,
147+
maxReplayDuration: MAX_REPLAY_DURATION,
145148
},
146149
{
147150
...SAMPLE_OPTIONS,
@@ -175,6 +178,7 @@ describe('Unit | session | loadOrCreateSession', () => {
175178
undefined,
176179
{
177180
timeouts: { ...timeouts, sessionIdleExpire: 1000 },
181+
maxReplayDuration: MAX_REPLAY_DURATION,
178182
},
179183
{
180184
...SAMPLE_OPTIONS,
@@ -208,6 +212,7 @@ describe('Unit | session | loadOrCreateSession', () => {
208212
undefined,
209213
{
210214
timeouts: { ...timeouts, sessionIdleExpire: 5000 },
215+
maxReplayDuration: MAX_REPLAY_DURATION,
211216
},
212217
{
213218
...SAMPLE_OPTIONS,
@@ -237,6 +242,7 @@ describe('Unit | session | loadOrCreateSession', () => {
237242
currentSession,
238243
{
239244
timeouts,
245+
maxReplayDuration: MAX_REPLAY_DURATION,
240246
},
241247
{
242248
...SAMPLE_OPTIONS,
@@ -267,6 +273,7 @@ describe('Unit | session | loadOrCreateSession', () => {
267273
currentSession,
268274
{
269275
timeouts: { ...timeouts, sessionIdleExpire: 1000 },
276+
maxReplayDuration: MAX_REPLAY_DURATION,
270277
},
271278
{
272279
...SAMPLE_OPTIONS,
@@ -294,6 +301,7 @@ describe('Unit | session | loadOrCreateSession', () => {
294301
currentSession,
295302
{
296303
timeouts: { ...timeouts, sessionIdleExpire: 1000 },
304+
maxReplayDuration: MAX_REPLAY_DURATION,
297305
},
298306
{
299307
...SAMPLE_OPTIONS,
@@ -323,6 +331,7 @@ describe('Unit | session | loadOrCreateSession', () => {
323331
currentSession,
324332
{
325333
timeouts: { ...timeouts, sessionIdleExpire: 5000 },
334+
maxReplayDuration: MAX_REPLAY_DURATION,
326335
},
327336
{
328337
...SAMPLE_OPTIONS,
@@ -342,6 +351,7 @@ describe('Unit | session | loadOrCreateSession', () => {
342351
undefined,
343352
{
344353
timeouts,
354+
maxReplayDuration: MAX_REPLAY_DURATION,
345355
},
346356
{
347357
...SAMPLE_OPTIONS,
@@ -366,6 +376,7 @@ describe('Unit | session | loadOrCreateSession', () => {
366376
undefined,
367377
{
368378
timeouts,
379+
maxReplayDuration: MAX_REPLAY_DURATION,
369380
},
370381
{
371382
...SAMPLE_OPTIONS,
@@ -382,6 +393,7 @@ describe('Unit | session | loadOrCreateSession', () => {
382393
undefined,
383394
{
384395
timeouts,
396+
maxReplayDuration: MAX_REPLAY_DURATION,
385397
},
386398
{
387399
...SAMPLE_OPTIONS,

packages/replay/test/unit/session/maybeRefreshSession.test.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {
2-
MAX_SESSION_LIFE,
2+
MAX_REPLAY_DURATION,
33
SESSION_IDLE_EXPIRE_DURATION,
44
SESSION_IDLE_PAUSE_DURATION,
55
WINDOW,
@@ -25,7 +25,6 @@ const SAMPLE_OPTIONS: SessionOptions = {
2525
const timeouts: Timeouts = {
2626
sessionIdlePause: SESSION_IDLE_PAUSE_DURATION,
2727
sessionIdleExpire: SESSION_IDLE_EXPIRE_DURATION,
28-
maxSessionLife: MAX_SESSION_LIFE,
2928
};
3029

3130
function createMockSession(when: number = Date.now(), id = 'test_session_id') {
@@ -57,6 +56,7 @@ describe('Unit | session | maybeRefreshSession', () => {
5756
currentSession,
5857
{
5958
timeouts,
59+
maxReplayDuration: MAX_REPLAY_DURATION,
6060
},
6161
{
6262
...SAMPLE_OPTIONS,
@@ -76,6 +76,7 @@ describe('Unit | session | maybeRefreshSession', () => {
7676
currentSession,
7777
{
7878
timeouts: { ...timeouts, sessionIdleExpire: 1000 },
79+
maxReplayDuration: MAX_REPLAY_DURATION,
7980
},
8081
{
8182
...SAMPLE_OPTIONS,
@@ -115,6 +116,7 @@ describe('Unit | session | maybeRefreshSession', () => {
115116
currentSession,
116117
{
117118
timeouts: { ...timeouts, sessionIdleExpire: 1000 },
119+
maxReplayDuration: MAX_REPLAY_DURATION,
118120
},
119121
{
120122
...SAMPLE_OPTIONS,
@@ -141,6 +143,7 @@ describe('Unit | session | maybeRefreshSession', () => {
141143
currentSession,
142144
{
143145
timeouts: { ...timeouts, sessionIdleExpire: 1000 },
146+
maxReplayDuration: MAX_REPLAY_DURATION,
144147
},
145148
{
146149
...SAMPLE_OPTIONS,
@@ -169,6 +172,7 @@ describe('Unit | session | maybeRefreshSession', () => {
169172
currentSession,
170173
{
171174
timeouts: { ...timeouts, sessionIdleExpire: 5000 },
175+
maxReplayDuration: MAX_REPLAY_DURATION,
172176
},
173177
{
174178
...SAMPLE_OPTIONS,
@@ -197,6 +201,7 @@ describe('Unit | session | maybeRefreshSession', () => {
197201
currentSession,
198202
{
199203
timeouts: { ...timeouts, sessionIdleExpire: 1000 },
204+
maxReplayDuration: MAX_REPLAY_DURATION,
200205
},
201206
{
202207
...SAMPLE_OPTIONS,
@@ -224,6 +229,7 @@ describe('Unit | session | maybeRefreshSession', () => {
224229
currentSession,
225230
{
226231
timeouts: { ...timeouts, sessionIdleExpire: 1000 },
232+
maxReplayDuration: MAX_REPLAY_DURATION,
227233
},
228234
{
229235
...SAMPLE_OPTIONS,
@@ -251,6 +257,7 @@ describe('Unit | session | maybeRefreshSession', () => {
251257
currentSession,
252258
{
253259
timeouts: { ...timeouts, sessionIdleExpire: 1000 },
260+
maxReplayDuration: MAX_REPLAY_DURATION,
254261
},
255262
{
256263
...SAMPLE_OPTIONS,

yarn.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4414,10 +4414,10 @@
44144414
fflate "^0.4.4"
44154415
mitt "^1.1.3"
44164416

4417-
"@sentry/[email protected].0":
4418-
version "0.6.0"
4419-
resolved "https://registry.yarnpkg.com/@sentry/bundler-plugin-core/-/bundler-plugin-core-0.6.0.tgz#70ad3740b2f90cdca1aff5fdbcd7306566a2f51e"
4420-
integrity sha512-gDPBkFxiOkc525U9pxnGMI5B2DAG0+UCsNuiNgl9+AieDcPSYTwdzfGHytxDZrQgPMvIHEnTAp1VlNB+6UxUGQ==
4417+
"@sentry/[email protected].1":
4418+
version "0.6.1"
4419+
resolved "https://registry.yarnpkg.com/@sentry/bundler-plugin-core/-/bundler-plugin-core-0.6.1.tgz#6c6a2ff3cdc98cd0ff1c30c59408cee9f067adf2"
4420+
integrity sha512-EecCJKp9ERM7J93DNDJTvkY78UiD/IfOjBdXWnaUVE0n619O7LfMVjwlXzxRJKl2x05dBE3lDraILLDGxCf6fg==
44214421
dependencies:
44224422
"@sentry/cli" "^2.17.0"
44234423
"@sentry/node" "^7.19.0"
@@ -4464,12 +4464,12 @@
44644464
proxy-from-env "^1.1.0"
44654465
which "^2.0.2"
44664466

4467-
"@sentry/vite-plugin@^0.6.0":
4468-
version "0.6.0"
4469-
resolved "https://registry.yarnpkg.com/@sentry/vite-plugin/-/vite-plugin-0.6.0.tgz#3902a5224d52b06d753a1deeb6b722bf6523840c"
4470-
integrity sha512-3J1ESvbI5okGJaSWm+gTAOOIa96u4ZwfI/C3n+0HSStz3e4vGiGUh59iNyb1/2m5HFgR5OLaHNfAvlyP8GM/ew==
4467+
"@sentry/vite-plugin@^0.6.1":
4468+
version "0.6.1"
4469+
resolved "https://registry.yarnpkg.com/@sentry/vite-plugin/-/vite-plugin-0.6.1.tgz#31eb744e8d87b1528eed8d41433647727a62e7c0"
4470+
integrity sha512-qkvKaSOcNhNWcdxRXLSs+8cF3ey0XIRmEzTl8U7sTTcZwuOMHsJB+HsYij6aTGaqsKfP8w1ozVt9szBAiL4//w==
44714471
dependencies:
4472-
"@sentry/bundler-plugin-core" "0.6.0"
4472+
"@sentry/bundler-plugin-core" "0.6.1"
44734473

44744474
44754475
version "1.19.0"

0 commit comments

Comments
 (0)