Use awaitAll extension

pull/1051/head
Alex Baker 4 years ago
parent 3cf2c76f8a
commit ed70e60c55

@ -4,10 +4,7 @@ import android.content.Context
import androidx.hilt.Assisted import androidx.hilt.Assisted
import androidx.hilt.work.WorkerInject import androidx.hilt.work.WorkerInject
import androidx.work.WorkerParameters import androidx.work.WorkerParameters
import kotlinx.coroutines.Deferred import kotlinx.coroutines.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.coroutineScope
import org.tasks.LocalBroadcastManager import org.tasks.LocalBroadcastManager
import org.tasks.analytics.Firebase import org.tasks.analytics.Firebase
import org.tasks.caldav.CaldavSynchronizer import org.tasks.caldav.CaldavSynchronizer
@ -45,7 +42,7 @@ class SyncWork @WorkerInject constructor(
preferences.isSyncOngoing = true preferences.isSyncOngoing = true
localBroadcastManager.broadcastRefresh() localBroadcastManager.broadcastRefresh()
try { try {
caldavJobs().plus(googleTaskJobs()).forEach { it.await() } caldavJobs().plus(googleTaskJobs()).awaitAll()
} catch (e: Exception) { } catch (e: Exception) {
firebase.reportException(e) firebase.reportException(e)
} finally { } finally {

Loading…
Cancel
Save