Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ constructor(
CoroutineScope(backgroundDispatcher).launch {
try {
sessionDataStore.updateData {
// TODO(mrober): Double check time makes sense?
sessionData.copy(backgroundTime = timeProvider.currentTime())
}
} catch (ex: Exception) {
Expand Down Expand Up @@ -138,10 +137,17 @@ constructor(
currentSessionData.processDataMap
}

val currentSession =
if (isColdStart) {
// For a cold start, do not keep the current session
null
} else {
currentSessionData.sessionDetails
}

// This is an expression, and returns the updated session data
if (isSessionExpired || isColdStart) {
val newSessionDetails =
sessionGenerator.generateNewSession(currentSessionData.sessionDetails)
val newSessionDetails = sessionGenerator.generateNewSession(currentSession)
sessionFirelogPublisher.mayLogSession(sessionDetails = newSessionDetails)
processDataManager.onSessionGenerated()
currentSessionData.copy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,7 @@ class SharedSessionRepositoryTest {
fakeDataStore.close()

assertThat(sharedSessionRepository.localSessionData.sessionDetails)
.isEqualTo(
SessionDetails(SESSION_ID_1, SESSION_ID_INIT, 1, fakeTimeProvider.currentTime().us)
)
.isEqualTo(SessionDetails(SESSION_ID_1, SESSION_ID_1, 0, fakeTimeProvider.currentTime().us))
}

@Test
Expand Down
Loading