-
Notifications
You must be signed in to change notification settings - Fork 10
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
Fixing background sessions logic in SessionController
#72
Merged
Conversation
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
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Manifest Files |
Generated by 🚫 Danger Swift against b31d80d |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #72 +/- ##
==========================================
+ Coverage 91.76% 91.82% +0.06%
==========================================
Files 403 404 +1
Lines 26152 26302 +150
==========================================
+ Hits 23999 24153 +154
+ Misses 2153 2149 -4
|
atreat
reviewed
Sep 25, 2024
Sources/EmbraceCore/Session/Lifecycle/Implementations/iOSSessionLifecycle.swift
Outdated
Show resolved
Hide resolved
ArielDemarco
approved these changes
Sep 30, 2024
atreat
reviewed
Sep 30, 2024
Sources/EmbraceCore/Capture/OneTimeServices/AppInfoCaptureService.swift
Outdated
Show resolved
Hide resolved
atreat
reviewed
Sep 30, 2024
atreat
approved these changes
Oct 2, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Even though we were parsing the background sessions remote config, we were never actually using it in the session logic.
This PR adds the necessary validations into
SessionController
to drop background sessions if the config is disabled.There's one special case that we have to deal with when the app is starting. In this scenario we can't know right away if the app is actually starting in the background or not.
Due to this, the cold start session is always created even if the app is in the background and the config is disabled.
Once the session ends it will be dropped unless the session state was updated to foreground.
We also updated the logic for "coldStart" sessions. Due to the changes in iOS 15 where apps can be pre-warmed by the OS, our calculations for the process start time are not accurate. For this reason we can't really know for sure how much time has passed since the process started and the first session is created.
For this reason we will always flag the very first session as the "coldStart" session, regardless on how much time has passed since the process started.
Additionally, this PR adds 2 new resources: process start time and process pre warm.