Don't crash on timeout in renewCache() (#8986)
Fixes #8962. withTimeout throws a TimeoutCancellationException if the timeout expires. To avoid crashing renewalJob when there are no extensions, use withTimeoutOrNull which does not throw on timeout.
This commit is contained in:
parent
b4b3a4d286
commit
3a82b4d924
@ -28,7 +28,7 @@ import kotlinx.coroutines.flow.onStart
|
|||||||
import kotlinx.coroutines.flow.receiveAsFlow
|
import kotlinx.coroutines.flow.receiveAsFlow
|
||||||
import kotlinx.coroutines.flow.shareIn
|
import kotlinx.coroutines.flow.shareIn
|
||||||
import kotlinx.coroutines.flow.stateIn
|
import kotlinx.coroutines.flow.stateIn
|
||||||
import kotlinx.coroutines.withTimeout
|
import kotlinx.coroutines.withTimeoutOrNull
|
||||||
import logcat.LogPriority
|
import logcat.LogPriority
|
||||||
import tachiyomi.domain.chapter.model.Chapter
|
import tachiyomi.domain.chapter.model.Chapter
|
||||||
import tachiyomi.domain.manga.model.Manga
|
import tachiyomi.domain.manga.model.Manga
|
||||||
@ -276,7 +276,7 @@ class DownloadCache(
|
|||||||
var sources = getSources()
|
var sources = getSources()
|
||||||
|
|
||||||
// Try to wait until extensions and sources have loaded
|
// Try to wait until extensions and sources have loaded
|
||||||
withTimeout(30.seconds) {
|
withTimeoutOrNull(30.seconds) {
|
||||||
while (!extensionManager.isInitialized) {
|
while (!extensionManager.isInitialized) {
|
||||||
delay(2.seconds)
|
delay(2.seconds)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user