Skip to content

Commit 4202b6a

Browse files
runningcodeclaude
andcommitted
docs(android): Simplify the wall-clock note on isSessionOnScopeStale (JAVA-573)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 623018f commit 4202b6a

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

‎sentry-android-core/src/main/java/io/sentry/android/core/LifecycleWatcher.java‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,15 @@ private void startSession() {
7373
}
7474

7575
/**
76-
* Whether the session already bound to the scope is old enough that foregrounding should rotate
77-
* it.
76+
* Whether the session on the scope is too old to resume, so foregrounding should start a new one.
7877
*
79-
* <p>Only reached before the app has been backgrounded in this process — a session started during
80-
* SDK init, most often. There is no tick to compare against at that point: the only record of
81-
* when that session started is {@link Session#getStarted()}, which is a wall-clock instant
82-
* because it is serialized and sent, so this comparison has to be a wall-clock one and inherits
83-
* the clock steps that come with it.
78+
* <p>Used when no background window is pending, which means the session was started by SDK init
79+
* rather than by leaving and returning to the app. Nothing captured a tick back then, and the
80+
* only record of when the session started is {@link Session#getStarted()} — a wall-clock instant,
81+
* because it is sent to Sentry. So this check stays on the wall clock, clock steps included.
8482
*
85-
* <p>TODO [MAJOR]: have a session record the tick it started on, so this can be a {@link
86-
* Deadline} like the background window is. That tick would have to stay out of the payload.
83+
* <p>TODO [MAJOR]: let a session remember the tick it started on, so this can use a {@link
84+
* Deadline} too. That tick must not be serialized.
8785
*/
8886
private boolean isSessionOnScopeStale() {
8987
final long nowMillis = TimeUnit.NANOSECONDS.toMillis(epochClock.now().epochNanos());

0 commit comments

Comments
 (0)