DownloadWorker: Move downloads observing logic into worker as well

This allows us to keep all the modifications related to DownloadWorker in a
single place.

Also, drop the 3seconds delay and do the cleanup instead of delegating it to
worker if last job was failed. This is better and more error-proof.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2023-11-30 13:26:47 +05:30
parent 77738d8549
commit b2cbc8dc16
5 changed files with 66 additions and 63 deletions

View File

@@ -28,15 +28,3 @@ fun <T> MutableSet<T>.flushAndAdd(list: Set<T>) {
clear()
addAll(list)
}
fun <T> MutableSet<T>.copyAndAdd(element: T): MutableSet<T> {
val newSet = this.toMutableSet()
newSet.add(element)
return newSet
}
fun <T> MutableSet<T>.copyAndRemove(element: T): MutableSet<T> {
val newSet = this.toMutableSet()
newSet.remove(element)
return newSet
}