From 26580744d163a4adf435dada883a86b59de6afef Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 5 Sep 2021 08:38:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E6=BB=A1=E8=B6=B3=E5=B9=B6=E5=8F=91?= =?UTF-8?q?=E7=8E=87=E6=97=B6=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt index 99b636a48..65d1ae59a 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt @@ -15,7 +15,6 @@ import io.legado.app.help.CacheManager import io.legado.app.help.JsExtensions import io.legado.app.help.http.* import io.legado.app.utils.* -import kotlinx.coroutines.delay import java.net.URLEncoder import java.util.* import java.util.regex.Pattern @@ -268,7 +267,7 @@ class AnalyzeUrl( /** * 根据书源并发率等待 */ - private suspend fun concurrentWait() { + private fun judgmentConcurrent() { source ?: return val concurrentRate = source.concurrentRate if (concurrentRate.isNullOrEmpty()) { @@ -311,7 +310,7 @@ class AnalyzeUrl( } } if (waitTime > 0) { - delay(waitTime) + error("根据并发率还需等待${waitTime}毫秒才可以访问") } } @@ -322,7 +321,7 @@ class AnalyzeUrl( if (type != null) { return StrResponse(url, StringUtils.byteToHexString(getByteArray())) } - concurrentWait() + judgmentConcurrent() setCookie(source?.getStoreUrl()) if (useWebView) { val params = AjaxWebView.AjaxParams(url) @@ -351,7 +350,7 @@ class AnalyzeUrl( } suspend fun getByteArray(): ByteArray { - concurrentWait() + judgmentConcurrent() setCookie(source?.getStoreUrl()) @Suppress("BlockingMethodInNonBlockingContext") return getProxyClient(proxy).newCall(retry) {