File tree Expand file tree Collapse file tree
sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ object SampleDatabases {
5353 private set
5454
5555 @Volatile private var warmUpComplete = false
56+ @Volatile private var warmUpGeneration = 0
5657 @Volatile private var warmUpJob: Job ? = null
5758
5859 fun isWarmUpComplete (): Boolean = warmUpComplete
@@ -259,6 +260,7 @@ object SampleDatabases {
259260 /* * Opens every database on a background thread, forcing the one-time open + bootstrap to run. */
260261 fun warmUp (context : Context ) {
261262 val appContext = context.applicationContext
263+ val generation = ++ warmUpGeneration
262264 warmUpComplete = false
263265 warmUpErrors = " "
264266 // Fire-and-forget: the warm-up outlives no particular screen, so a bare scope is fine here.
@@ -289,8 +291,10 @@ object SampleDatabases {
289291 .countSongs()
290292 .executeAsOne()
291293 }
292- warmUpErrors = failures.joinToString(" \n " ) { " Warm-up failed: $it " }
293- warmUpComplete = true
294+ if (generation == warmUpGeneration) {
295+ warmUpErrors = failures.joinToString(" \n " ) { " Warm-up failed: $it " }
296+ warmUpComplete = true
297+ }
294298 }
295299 }
296300
You can’t perform that action at this time.
0 commit comments