retry download workers on resume
This commit is contained in:
@@ -156,7 +156,13 @@ public class Downloader {
|
||||
}
|
||||
|
||||
public void resume() {
|
||||
downloadManager.resume(this)
|
||||
activeWorkers.each { destination, worker ->
|
||||
if (worker.currentState == WorkerState.FINISHED) {
|
||||
def newWorker = new DownloadWorker(destination)
|
||||
activeWorkers.put(destination, newWorker)
|
||||
executorService.submit(newWorker)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DownloadWorker implements Runnable {
|
||||
|
@@ -110,7 +110,9 @@ class MainFrameModel {
|
||||
lastRetryTime = now
|
||||
runInsideUIAsync {
|
||||
downloads.each {
|
||||
if (it.downloader.currentState == Downloader.DownloadState.FAILED)
|
||||
def state = it.downloader.currentState
|
||||
if (state == Downloader.DownloadState.FAILED ||
|
||||
state == Downloader.DownloadState.DOWNLOADING)
|
||||
it.downloader.resume()
|
||||
updateTablePreservingSelection("downloads-table")
|
||||
}
|
||||
|
Reference in New Issue
Block a user