@@ -13,7 +13,7 @@ import { generateUUIDv4, isWindowObjectUnavailable } from "./utils.js";
1313import { Lifetime } from "./metrics/lifetime.js" ;
1414import log , { LoggingLevel } from "./log.js" ;
1515import { Context } from "./context.js" ;
16- import { hasSessionBeenInactiveForOverThirtyMinutes } from "./sessions.js" ;
16+ import { isSessionInactive } from "./sessions.js" ;
1717
1818const LOG_TAG = "core.InternalMetrics" ;
1919
@@ -193,11 +193,10 @@ export class CoreMetrics {
193193 * 1. If this is the first session (there is no existing session ID),
194194 * then we set a new session ID and a lastActive timestamp.
195195 *
196- * 2. If the lastActive time is under 30 minutes, then we only update
197- * the lastActive time.
196+ * 2. If the session is not expired, then we only update the lastActive time.
198197 *
199- * 3. If the lastActive time is over 30 minutes, then we update the
200- * session ID, the session sequence number, and the lastActive time.
198+ * 3. If the session is expired (inactive threshold is more recent than lastActive)
199+ * then we update the session ID, the session sequence number, and the lastActive time.
201200 */
202201 updateSessionInfo ( ) : void {
203202 if ( isWindowObjectUnavailable ( ) ) {
@@ -211,9 +210,8 @@ export class CoreMetrics {
211210
212211 if ( existingSessionId ) {
213212 try {
214- // If over 30 minutes has passed since last session interaction,
215- // then we create a new session.
216- if ( hasSessionBeenInactiveForOverThirtyMinutes ( ) ) {
213+ // If the session has timed out, then we create a new session.
214+ if ( isSessionInactive ( ) ) {
217215 this . generateNewSession ( ) ;
218216 }
219217 } catch ( e ) {
0 commit comments