mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -14,6 +14,7 @@ import io.legado.app.model.analyzeRule.AnalyzeRule
|
||||
import io.legado.app.model.analyzeRule.AnalyzeUrl
|
||||
import io.legado.app.utils.HtmlFormatter
|
||||
import io.legado.app.utils.NetworkUtils
|
||||
import kotlinx.coroutines.CoroutineStart
|
||||
import kotlinx.coroutines.Dispatchers.IO
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.ensureActive
|
||||
@@ -103,8 +104,10 @@ object BookContent {
|
||||
} else if (contentData.second.size > 1) {
|
||||
Debug.log(bookSource.bookSourceUrl, "◇并发解析正文,总页数:${contentData.second.size}")
|
||||
withContext(IO) {
|
||||
val asyncStart =
|
||||
if (contentData.second.size > 5) CoroutineStart.LAZY else CoroutineStart.DEFAULT
|
||||
val asyncArray = Array(contentData.second.size) {
|
||||
async(IO) {
|
||||
async(IO, start = asyncStart) {
|
||||
val urlStr = contentData.second[it]
|
||||
val res = AnalyzeUrl(
|
||||
mUrl = urlStr,
|
||||
|
||||
Reference in New Issue
Block a user