Fix indexing notif not showing (#8758)

(cherry picked from commit 235bc7745734fdda4cbcfe42452d611e8fa6693c)
This commit is contained in:
Ivan Iskandar 2022-12-17 22:32:49 +07:00 committed by Jobobby04
parent 5a449ec80a
commit 149ac4a363

View File

@ -12,6 +12,8 @@ import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceManager
import eu.kanade.tachiyomi.util.lang.launchIO
import eu.kanade.tachiyomi.util.lang.launchNonCancellable
import eu.kanade.tachiyomi.util.system.logcat
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
@ -29,6 +31,7 @@ import kotlinx.coroutines.flow.receiveAsFlow
import kotlinx.coroutines.flow.shareIn
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.withTimeout
import logcat.LogPriority
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.util.concurrent.ConcurrentHashMap
@ -334,10 +337,18 @@ class DownloadCache(
}
}
.awaitAll()
lastRenew = System.currentTimeMillis()
notifyChanges()
}.also {
it.invokeOnCompletion(onCancelling = true) { exception ->
if (exception != null && exception !is CancellationException) {
logcat(LogPriority.ERROR, exception) { "Failed to create download cache" }
}
lastRenew = System.currentTimeMillis()
notifyChanges()
}
}
// Mainly to notify the indexing notifier UI
notifyChanges()
}
private fun getSources(): List<Source> {