From b3737448d79be9a2b3f07d4ba29245f1f7661b4e Mon Sep 17 00:00:00 2001 From: Dude so hot Date: Tue, 31 Dec 2024 18:07:58 +0800 Subject: [PATCH] Don't retry at one H@H twice Now that quota is cheap --- .../com/hippo/ehviewer/spider/SpiderQueen.kt | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/app/src/main/kotlin/com/hippo/ehviewer/spider/SpiderQueen.kt b/app/src/main/kotlin/com/hippo/ehviewer/spider/SpiderQueen.kt index 065476135..9fbe12798 100644 --- a/app/src/main/kotlin/com/hippo/ehviewer/spider/SpiderQueen.kt +++ b/app/src/main/kotlin/com/hippo/ehviewer/spider/SpiderQueen.kt @@ -635,26 +635,24 @@ class SpiderQueen private constructor(val galleryInfo: GalleryInfo) : CoroutineS } checkNotNull(targetImageUrl) - repeat(2) { times -> - runCatching { - logcat(WORKER_DEBUG_TAG) { "Start download image $index attempt #$times" } - spiderDen.makeHttpCallAndSaveImage( - index, - targetImageUrl, - referer, - this@SpiderQueen::notifyPageDownload.partially1(index), - ) - logcat(WORKER_DEBUG_TAG) { "Download image $index succeed" } - updatePageState(index, STATE_FINISHED) - return - }.onFailure { - spiderDen.removeIntermediateFiles(index) - logcat(WORKER_DEBUG_TAG) { "Download image $index attempt #$times failed" } - when (it) { - is CancellationException, is FileNotFoundException -> throw it - } - error = it.displayString() + runCatching { + logcat(WORKER_DEBUG_TAG) { "Start download image $index" } + spiderDen.makeHttpCallAndSaveImage( + index, + targetImageUrl, + referer, + this@SpiderQueen::notifyPageDownload.partially1(index), + ) + logcat(WORKER_DEBUG_TAG) { "Download image $index succeed" } + updatePageState(index, STATE_FINISHED) + return + }.onFailure { + spiderDen.removeIntermediateFiles(index) + logcat(WORKER_DEBUG_TAG) { "Download image $index attempt" } + when (it) { + is CancellationException, is FileNotFoundException -> throw it } + error = it.displayString() } } }.onFailure {