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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user