From bf22fe9731b64087460286931c43e9301e0b23cb Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 27 Aug 2019 14:39:54 +0800 Subject: [PATCH] up --- app/src/main/java/io/legado/app/ui/search/SearchViewModel.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/io/legado/app/ui/search/SearchViewModel.kt b/app/src/main/java/io/legado/app/ui/search/SearchViewModel.kt index 7ab0db2d8..b05dca440 100644 --- a/app/src/main/java/io/legado/app/ui/search/SearchViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/search/SearchViewModel.kt @@ -7,6 +7,7 @@ import io.legado.app.data.entities.SearchBook import io.legado.app.help.coroutine.Coroutine import io.legado.app.model.WebBook import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.delay class SearchViewModel(application: Application) : BaseViewModel(application) { private var task: Coroutine<*>? = null @@ -25,6 +26,7 @@ class SearchViewModel(application: Application) : BaseViewModel(application) { //onCleared时自动取消 val bookSourceList = App.db.bookSourceDao().allEnabled for (item in bookSourceList) { + delay(100)//每隔100毫秒搜索一个书源 //task取消时自动取消 by (scope = this@execute) WebBook(item).searchBook(key, searchPage, scope = this@execute) .timeout(30000L)