From 87268b3ef68f3c734a28562287cc2ed73479a336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Borcz?= Date: Tue, 26 Mar 2019 16:47:14 +0100 Subject: [PATCH] Fix rejected execution in sync worker (#305) --- .../java/io/github/wulkanowy/services/sync/SyncWorker.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/SyncWorker.kt b/app/src/main/java/io/github/wulkanowy/services/sync/SyncWorker.kt index 36593966..134fb034 100644 --- a/app/src/main/java/io/github/wulkanowy/services/sync/SyncWorker.kt +++ b/app/src/main/java/io/github/wulkanowy/services/sync/SyncWorker.kt @@ -19,7 +19,6 @@ import io.github.wulkanowy.services.sync.channels.DebugChannel import io.github.wulkanowy.services.sync.works.Work import io.github.wulkanowy.utils.getCompatColor import io.reactivex.Completable -import io.reactivex.Flowable import io.reactivex.Single import timber.log.Timber import kotlin.random.Random @@ -42,12 +41,12 @@ class SyncWorker @AssistedInject constructor( .flatMapCompletable { student -> semesterRepository.getCurrentSemester(student, true) .flatMapCompletable { semester -> - Completable.mergeDelayError(Flowable.fromIterable(works.map { work -> + Completable.mergeDelayError(works.map { work -> work.create(student, semester) .doOnSubscribe { Timber.i("${work::class.java.simpleName} is starting") } .doOnError { Timber.i("${work::class.java.simpleName} result: An exception occurred") } .doOnComplete { Timber.i("${work::class.java.simpleName} result: Success") } - }), 3) + }) } } .toSingleDefault(Result.success())