Skip to content

Commit 7cb98e0

Browse files
committed
Fix firelog send
1 parent 21ddec3 commit 7cb98e0

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

firebase-sessions/src/main/kotlin/com/google/firebase/sessions/SharedSessionRepository.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,18 @@ constructor(
9090
Log.d(TAG, "App foregrounded on ${getProcessName()} - $sessionData")
9191

9292
if (shouldInitiateNewSession(sessionData)) {
93-
// Generate new session details on main thread so the timestamp is as current as possible
94-
val newSessionDetails = sessionGenerator.generateNewSession(sessionData.sessionDetails)
95-
9693
CoroutineScope(backgroundDispatcher).launch {
9794
sessionDataStore.updateData { currentSessionData ->
9895
// Double-check pattern
9996
if (shouldInitiateNewSession(currentSessionData)) {
97+
val newSessionDetails = sessionGenerator.generateNewSession(sessionData.sessionDetails)
98+
sessionFirelogPublisher.mayLogSession(sessionDetails = newSessionDetails)
10099
currentSessionData.copy(sessionDetails = newSessionDetails)
101100
} else {
102101
currentSessionData
103102
}
104103
}
105104
}
106-
sessionFirelogPublisher.mayLogSession(sessionDetails = newSessionDetails)
107105
}
108106
}
109107

0 commit comments

Comments
 (0)