From cf4ba745f806771acd7bd2422ef2649fceb1642e Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 1 Jun 2022 11:13:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/model/analyzeRule/AnalyzeRule.kt | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt index 4d38cdef0..966da469b 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt @@ -12,6 +12,7 @@ import io.legado.app.help.http.CookieStore import io.legado.app.model.webBook.WebBook import io.legado.app.utils.* import kotlinx.coroutines.runBlocking +import kotlinx.coroutines.withTimeout import org.jsoup.nodes.Entities import org.mozilla.javascript.NativeObject import java.net.URL @@ -712,14 +713,16 @@ class AnalyzeRule( val book = book as? Book if (bookSource == null || book == null) return runBlocking { - WebBook.preciseSearchAwait(this, bookSource, book.name, book.author) - .getOrThrow().let { - book.bookUrl = it.bookUrl - it.variableMap.forEach { entry -> - book.putVariable(entry.key, entry.value) + withTimeout(1800000) { + WebBook.preciseSearchAwait(this, bookSource, book.name, book.author) + .getOrThrow().let { + book.bookUrl = it.bookUrl + it.variableMap.forEach { entry -> + book.putVariable(entry.key, entry.value) + } } - } - WebBook.getBookInfoAwait(this, bookSource, book, false) + WebBook.getBookInfoAwait(this, bookSource, book, false) + } } } @@ -731,7 +734,9 @@ class AnalyzeRule( val book = book as? Book if (bookSource == null || book == null) return runBlocking { - WebBook.getBookInfoAwait(this, bookSource, book) + withTimeout(1800000) { + WebBook.getBookInfoAwait(this, bookSource, book) + } } }