Skip to content
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

Avoid starting a session if one already exists #1327

Merged
merged 1 commit into from
Mar 8, 2021

Conversation

imjoehaines
Copy link
Contributor

Goal

This change prevents multiple sessions from being started if separate plugins both call 'startSession' by making 'resumeSession' do nothing if a session already exists

This is necessary in order to run serverless versions of Express/Koa/Restify with autoTrackSessions on because both the AWS Lambda plugin and the framework plugin will attempt to start a session (resulting in 2 sessions per request)

@github-actions
Copy link

github-actions bot commented Mar 4, 2021

@bugsnag/browser bundle size diff

Minified Minfied + Gzipped
Before 40.83 kB 12.60 kB
After 40.84 kB 12.60 kB
± ⚠️ +13 bytes ⚠️ +5 bytes

code coverage diff

Ok File Lines Branches Functions Statements
🔴 /home/runner/work/bugsnag-js/bugsnag-js/packages/plugin-browser-session/session.js 95.24%
(-4.76%)
87.5%
(-12.5%)
100%
(+0%)
95.24%
(-4.76%)
🔴 /home/runner/work/bugsnag-js/bugsnag-js/packages/plugin-server-session/session.js 75%
(-1.09%)
50%
(+0%)
66.67%
(+0%)
71.15%
(-0.85%)

Total:

Lines Branches Functions Statements
81.47%(-0.04%) 70.32%(-0.05%) 84.01%(+0%) 80.38%(-0.04%)

Generated by 🚫 dangerJS against 441a361

This change prevents multiple sessions from being started if separate
plugins both call 'startSession' by making 'resumeSession' do nothing
if a session already exists
@imjoehaines imjoehaines merged commit ec0dbc7 into integration/aws-lambda Mar 8, 2021
@imjoehaines imjoehaines deleted the avoid-double-sessions branch March 8, 2021 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants