Skip to content
Snippets Groups Projects
Unverified Commit c20f7667 authored by BMItter's avatar BMItter Committed by GitHub
Browse files

After long update no exposure, additonal logs & potential fix (EXPSOUREAPP-4120) (#1818)


* Use startedAt as fallback when finishedAt ist null to avoid new download tasks get launched while a task is running

* Additional logging on DefaultDiagnosisKeyProvider

* work-runtime-ktx to latest stable

* better mapNotNull, adjusted Exception

* removed worker downgrade for separate PR

Co-authored-by: default avatarRalf Gehrer <ralfgehrer@users.noreply.github.com>
parent 9f96df1a
No related branches found
No related tags found
No related merge requests found
......@@ -59,6 +59,7 @@ class DefaultDiagnosisKeyProvider @Inject constructor(
provideDiagnosisKeysTask
.addOnSuccessListener { cont.resume(true) }
.addOnFailureListener {
Timber.w("Key submission failed because ${it.message}")
val wrappedException =
when (it is ApiException &&
it.statusCode == ReportingConstants.STATUS_CODE_REACHED_REQUEST_LIMIT) {
......
......@@ -26,7 +26,6 @@ import kotlinx.coroutines.flow.map
import kotlinx.coroutines.launch
import org.joda.time.Duration
import timber.log.Timber
import java.util.NoSuchElementException
import javax.inject.Inject
import javax.inject.Singleton
......@@ -153,11 +152,10 @@ class TracingRepository @Inject constructor(
val taskLastFinishedAt = try {
taskController.tasks.first()
.filter { it.taskState.type == DownloadDiagnosisKeysTask::class }
.mapNotNull { it.taskState.finishedAt }
.sortedDescending()
.first()
} catch (e: NoSuchElementException) {
Timber.tag(TAG).v("download did not run recently - no task with a finishedAt date found")
.mapNotNull { it.taskState.finishedAt ?: it.taskState.startedAt }
.maxOrNull()!!
} catch (e: NullPointerException) {
Timber.tag(TAG).v("download did not run recently - no task with a date found")
return true
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment