Fix skipping download errors
This commit is contained in:
@@ -311,6 +311,10 @@ class DownloadWorker @AssistedInject constructor(
|
||||
DOWNLOAD_ERROR_DELAY
|
||||
}
|
||||
if (countDown <= 0 || retryDelay < 0 || retryDelay > MAX_RETRY_DELAY) {
|
||||
val pausingHandle = PausingHandle.current()
|
||||
if (pausingHandle.skipAllErrors()) {
|
||||
return null
|
||||
}
|
||||
publishState(
|
||||
currentState.copy(
|
||||
isPaused = true,
|
||||
@@ -321,7 +325,6 @@ class DownloadWorker @AssistedInject constructor(
|
||||
),
|
||||
)
|
||||
countDown = MAX_FAILSAFE_ATTEMPTS
|
||||
val pausingHandle = PausingHandle.current()
|
||||
pausingHandle.pause()
|
||||
try {
|
||||
pausingHandle.awaitResumed()
|
||||
|
||||
@@ -53,7 +53,9 @@ class PausingHandle : AbstractCoroutineContextElement(PausingHandle) {
|
||||
}
|
||||
}
|
||||
|
||||
fun skipCurrentError(): Boolean = skipError.compareAndSet(expect = true, update = skipAllErrors)
|
||||
fun skipAllErrors(): Boolean = skipAllErrors
|
||||
|
||||
fun skipCurrentError(): Boolean = skipError.compareAndSet(expect = true, update = false)
|
||||
|
||||
companion object : CoroutineContext.Key<PausingHandle> {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user