BackgroundExecutor: cancel all tasks on user cancel, remove useless updateProgress call
This commit is contained in:
committed by
Natalia Selezneva
parent
19d35d7f27
commit
a89ce4c590
+5
-3
@@ -70,8 +70,6 @@ internal class BackgroundExecutor(
|
|||||||
if (queue.add(task)) {
|
if (queue.add(task)) {
|
||||||
debug(task.key) { "added to update queue" }
|
debug(task.key) { "added to update queue" }
|
||||||
|
|
||||||
updateProgress()
|
|
||||||
|
|
||||||
// If the queue is longer than PROGRESS_INDICATOR_MIN_QUEUE, show progress and cancel button
|
// If the queue is longer than PROGRESS_INDICATOR_MIN_QUEUE, show progress and cancel button
|
||||||
if (queue.size > PROGRESS_INDICATOR_MIN_QUEUE) {
|
if (queue.size > PROGRESS_INDICATOR_MIN_QUEUE) {
|
||||||
requireUnderProgressWorker()
|
requireUnderProgressWorker()
|
||||||
@@ -170,7 +168,11 @@ internal class BackgroundExecutor(
|
|||||||
val next = synchronized(this@BackgroundExecutor) {
|
val next = synchronized(this@BackgroundExecutor) {
|
||||||
if (shouldStop) return
|
if (shouldStop) return
|
||||||
|
|
||||||
if (checkCancelled() || queue.isEmpty()) {
|
if (checkCancelled()) {
|
||||||
|
queue.clear()
|
||||||
|
endBatch()
|
||||||
|
return
|
||||||
|
} else if (queue.isEmpty()) {
|
||||||
endBatch()
|
endBatch()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user