-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(replay): Streamline session creation/refresh #8813
Conversation
4ef8232
to
0ec5bf6
Compare
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, will do some manual testing tomorrow
Hmm do we not use codecov in this repo? |
Seeing an issue where we have stale events being flushed alongside the new session, Francesco will be looking into this tomorrow. |
afe8493
to
ebf8ba6
Compare
ebf8ba6
to
6b77c3c
Compare
Note: I updated this PR to fix another bug: Now, when we restore a session for sessionStorage, we only start in |
We've been using
_loadAndCheckSession
both in initial session setup as well as when checking for expiration of session.This leads to some not-so-optimized stuff, as we kind of have to do double duty in there (e.g. we constantly re-assign the session etc).
This streamlines this by splitting this into:
_initializeSessionForSampling()
: Only called ininitializeSampling()
_checkSession()
: Called everywhere else, assumes we have a session setup yetOnly the former actually looks into sessionStorage, the latter can assume we always have a session already.
This also extends the behavior so that if we fetch a
buffer
session from storage and segment_id > 0, we start the session insession
mode. Without this, we could theoretically run into endless sessions if the user keeps refreshing and keeps having errors, leading to continuous switchovers from buffer>session mode.