mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 08:11:50 +01:00
Delete from the download queue on the main thread. It could fix some crashes
This commit is contained in:
parent
1226023dc2
commit
0de214c3b5
@ -57,6 +57,12 @@ class DownloadManager(private val context: Context, private val sourceManager: S
|
|||||||
.lift(DynamicConcurrentMergeOperator<Download, Download>({ downloadChapter(it) }, threadsSubject))
|
.lift(DynamicConcurrentMergeOperator<Download, Download>({ downloadChapter(it) }, threadsSubject))
|
||||||
.onBackpressureBuffer()
|
.onBackpressureBuffer()
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.doOnNext {
|
||||||
|
// Delete successful downloads from queue
|
||||||
|
if (it.status == Download.DOWNLOADED) {
|
||||||
|
queue.del(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
.map { download -> areAllDownloadsFinished() }
|
.map { download -> areAllDownloadsFinished() }
|
||||||
.subscribe({ finished ->
|
.subscribe({ finished ->
|
||||||
if (finished!!) {
|
if (finished!!) {
|
||||||
@ -302,10 +308,6 @@ class DownloadManager(private val context: Context, private val sourceManager: S
|
|||||||
}
|
}
|
||||||
download.totalProgress = actualProgress
|
download.totalProgress = actualProgress
|
||||||
download.status = status
|
download.status = status
|
||||||
// Delete successful downloads from queue after notifying
|
|
||||||
if (status == Download.DOWNLOADED) {
|
|
||||||
queue.del(download)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the page list from the chapter's directory if it exists, null otherwise
|
// Return the page list from the chapter's directory if it exists, null otherwise
|
||||||
|
Loading…
Reference in New Issue
Block a user