mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-10-31 16:22:49 +00:00
Fix ANRs when calculating DB sizes for Sentry (#7017)
* Fix ANRs when calculating DB sizes for Sentry Instead of using the SDK's `Client.getStoreSizes()` method, manually check the sizes using the file system. For this, the `SessionPaths` need to be synchronously accessible from a `MatrixClient`. I removed `SessionPathsProvider` too since it's not needed anymore.
This commit is contained in:
committed by
GitHub
parent
8e9c0bedf2
commit
ac93044f49
+1
-2
@@ -33,7 +33,6 @@ import io.sentry.Sentry
|
||||
import io.sentry.SentryOptions
|
||||
import io.sentry.android.core.SentryAndroid
|
||||
import io.sentry.protocol.SentryTransaction
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import timber.log.Timber
|
||||
|
||||
@ContributesIntoSet(AppScope::class)
|
||||
@@ -132,7 +131,7 @@ class SentryAnalyticsProvider(
|
||||
if (sessionId != null) {
|
||||
// This runs in a separate thread, so although using `runBlocking` is not great, at least it shouldn't freeze the app
|
||||
// Also, the method is fairly quick, so the blocking shouldn't take longer than a few ms
|
||||
val databaseSizes = runBlocking { getDatabaseSizesUseCase(sessionId) }.getOrNull()
|
||||
val databaseSizes = getDatabaseSizesUseCase(sessionId).getOrNull()
|
||||
|
||||
databaseSizes?.stateStore?.let { transaction.setExtra(AnalyticsUserData.STATE_STORE_SIZE, it.into(ByteUnit.MB)) }
|
||||
databaseSizes?.eventCacheStore?.let { transaction.setExtra(AnalyticsUserData.EVENT_CACHE_SIZE, it.into(ByteUnit.MB)) }
|
||||
|
||||
Reference in New Issue
Block a user