@ -184,9 +184,7 @@ class DownloadService : BaseService() {
scope = this,
context = searchPool
).onError {
it.localizedMessage?.let {
Download.addLog(it)
}
Download.addLog(it.localizedMessage)
}.onSuccess(IO) { content ->
downloadCount[book.bookUrl]?.increaseSuccess()
BookHelp.saveContent(book, bookChapter, content)
@ -9,7 +9,8 @@ object Download {
val logs = arrayListOf<String>()
fun addLog(log: String) {
fun addLog(log: String?) {
log ?: return
synchronized(this) {
if (logs.size > 30) {
logs.removeAt(0)