下载加入超时判断

pull/306/head
gedoor 5 years ago
parent a5e2b51507
commit 64e5305999
  1. 6
      app/src/main/java/io/legado/app/service/DownloadService.kt

@ -188,12 +188,14 @@ class DownloadService : BaseService() {
bookChapter, bookChapter,
scope = this, scope = this,
context = searchPool context = searchPool
).onError { ).timeout(3000L)
.onError {
synchronized(this) { synchronized(this) {
downloadingList.remove(bookChapter.url) downloadingList.remove(bookChapter.url)
} }
Download.addLog(it.localizedMessage) Download.addLog(it.localizedMessage)
}.onSuccess(IO) { content -> }
.onSuccess(IO) { content ->
BookHelp.saveContent(book, bookChapter, content) BookHelp.saveContent(book, bookChapter, content)
synchronized(this@DownloadService) { synchronized(this@DownloadService) {
downloadCount[book.bookUrl]?.increaseSuccess() downloadCount[book.bookUrl]?.increaseSuccess()

Loading…
Cancel
Save