-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(replay): Fully stop & restart session when it expires
- Loading branch information
Showing
11 changed files
with
938 additions
and
1,274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { Session } from '../types'; | ||
import { isSessionExpired } from '../util/isSessionExpired'; | ||
|
||
/** If the session should be refreshed or not. */ | ||
export function shouldRefreshSession( | ||
session: Session, | ||
{ sessionIdleExpire, maxReplayDuration }: { sessionIdleExpire: number; maxReplayDuration: number }, | ||
): boolean { | ||
// If not expired, all good, just keep the session | ||
if (!isSessionExpired(session, { sessionIdleExpire, maxReplayDuration })) { | ||
return false; | ||
} | ||
|
||
// If we are buffering & haven't ever flushed yet, always continue | ||
if (session.sampled === 'buffer' && session.segmentId === 0) { | ||
return false; | ||
} | ||
|
||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.