|
|
|
@ -12,6 +12,7 @@ import io.legado.app.constant.Bus |
|
|
|
|
import io.legado.app.help.BookHelp |
|
|
|
|
import io.legado.app.help.IntentHelp |
|
|
|
|
import io.legado.app.help.coroutine.Coroutine |
|
|
|
|
import io.legado.app.help.threadCount |
|
|
|
|
import io.legado.app.model.WebBook |
|
|
|
|
import io.legado.app.utils.postEvent |
|
|
|
|
import kotlinx.coroutines.Dispatchers.IO |
|
|
|
@ -19,7 +20,8 @@ import kotlinx.coroutines.asCoroutineDispatcher |
|
|
|
|
import java.util.concurrent.Executors |
|
|
|
|
|
|
|
|
|
class DownloadService : BaseService() { |
|
|
|
|
private var searchPool = Executors.newFixedThreadPool(16).asCoroutineDispatcher() |
|
|
|
|
private var searchPool = |
|
|
|
|
Executors.newFixedThreadPool(App.INSTANCE.threadCount).asCoroutineDispatcher() |
|
|
|
|
private var tasks: ArrayList<Coroutine<*>> = arrayListOf() |
|
|
|
|
private val handler = Handler() |
|
|
|
|
private var runnable: Runnable = Runnable { upDownload() } |
|
|
|
|