修复分组内书籍数目少于搜索线程数目,会导致搜索线程数目变低

pull/840/head
gedoor 4 years ago
parent 09d50a52d1
commit 1049a5a567
  1. 5
      app/src/main/java/io/legado/app/ui/main/MainViewModel.kt

@ -66,8 +66,10 @@ class MainViewModel(application: Application) : BaseViewModel(application) {
@Synchronized @Synchronized
private fun updateToc() { private fun updateToc() {
var update = false
bookMap.forEach { bookEntry -> bookMap.forEach { bookEntry ->
if (!updateList.contains(bookEntry.key)) { if (!updateList.contains(bookEntry.key)) {
update = true
val book = bookEntry.value val book = bookEntry.value
synchronized(this) { synchronized(this) {
updateList.add(book.bookUrl) updateList.add(book.bookUrl)
@ -105,6 +107,9 @@ class MainViewModel(application: Application) : BaseViewModel(application) {
return return
} }
} }
if (!update) {
usePoolCount--
}
} }
private fun cacheBook(webBook: WebBook, book: Book) { private fun cacheBook(webBook: WebBook, book: Book) {

Loading…
Cancel
Save