diff --git a/app/src/main/java/io/legado/app/ui/main/MainViewModel.kt b/app/src/main/java/io/legado/app/ui/main/MainViewModel.kt index 098edef57..c9fc9066a 100644 --- a/app/src/main/java/io/legado/app/ui/main/MainViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/main/MainViewModel.kt @@ -23,7 +23,7 @@ import java.util.concurrent.CopyOnWriteArraySet import java.util.concurrent.Executors class MainViewModel(application: Application) : BaseViewModel(application) { - val threadCount = AppConfig.threadCount + private var threadCount = AppConfig.threadCount private var upTocPool = Executors.newFixedThreadPool(threadCount).asCoroutineDispatcher() val updateList = CopyOnWriteArraySet() private val bookMap = ConcurrentHashMap() @@ -37,8 +37,9 @@ class MainViewModel(application: Application) : BaseViewModel(application) { } fun upPool() { + threadCount = AppConfig.threadCount upTocPool.close() - upTocPool = Executors.newFixedThreadPool(AppConfig.threadCount).asCoroutineDispatcher() + upTocPool = Executors.newFixedThreadPool(threadCount).asCoroutineDispatcher() } fun upAllBookToc() {