Browse Source

Use IO dispatcher for cleanup in bug reporter (#3092)

pull/3096/head
Jorge Martin Espinosa 3 months ago committed by GitHub
parent
commit
40b7736fcf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      changelog.d/3086.bugfix
  2. 2
      features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporter.kt

1
changelog.d/3086.bugfix

@ -0,0 +1 @@
Make sure we don't use the main dispatcher while closing the bug report request, as it can lead to crashes in strict mode.

2
features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporter.kt

@ -282,6 +282,7 @@ class DefaultBugReporter @Inject constructor(
listener.onUploadFailed(serverError) listener.onUploadFailed(serverError)
} }
} finally { } finally {
withContext(coroutineDispatchers.io) {
// delete the generated files when the bug report process has finished // delete the generated files when the bug report process has finished
for (file in bugReportFiles) { for (file in bugReportFiles) {
file.safeDelete() file.safeDelete()
@ -289,6 +290,7 @@ class DefaultBugReporter @Inject constructor(
response?.close() response?.close()
} }
} }
}
override fun logDirectory(): File { override fun logDirectory(): File {
return File(context.cacheDir, LOG_DIRECTORY_NAME).apply { return File(context.cacheDir, LOG_DIRECTORY_NAME).apply {

Loading…
Cancel
Save