From 616e0aa2c6cdcb45a19a8a4d2001bd4d2e638b24 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Thu, 17 Oct 2019 16:28:08 -0400 Subject: [PATCH] 1589504: Fix logic handling timeout of queued tasks --- .../src/main/java/mozilla/telemetry/glean/Dispatchers.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/Dispatchers.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/Dispatchers.kt index 92a67b8f2..4dbde5786 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/Dispatchers.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/Dispatchers.kt @@ -144,12 +144,14 @@ internal object Dispatchers { // wait up to 5 seconds for it to complete, otherwise we will reset the flag so that // new tasks may continue to run. runBlocking { - withTimeoutOrNull(QUEUE_PROCESSING_TIMEOUT_MS) { + if (withTimeoutOrNull(QUEUE_PROCESSING_TIMEOUT_MS) { job.join() - }?.let { + } == null) { Log.e(LOG_TAG, "Timeout processing initial tasks queue") queueInitialTasks.set(false) taskQueue.clear() + } else { + Log.i(LOG_TAG, "Initial tasks queue completed successfully") } } }