mirror of https://github.com/zlatinb/muwire
Speed up mass resume/retry of downloads. GitHub issue #89
parent
6b105f96bb
commit
bc4f61bcdb
|
@ -220,22 +220,24 @@ class NetworkDownloader extends Downloader {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doResume() {
|
protected void doResume() {
|
||||||
readPieces()
|
executorService.submit {
|
||||||
destinations.stream().filter({!isHopeless(it)}).forEach { destination ->
|
readPieces()
|
||||||
log.fine("resuming source ${destination.toBase32()}")
|
destinations.stream().filter({ !isHopeless(it) }).forEach { destination ->
|
||||||
def worker = activeWorkers.get(destination)
|
log.fine("resuming source ${destination.toBase32()}")
|
||||||
if (worker != null) {
|
def worker = activeWorkers.get(destination)
|
||||||
if (worker.currentState == WorkerState.FINISHED) {
|
if (worker != null) {
|
||||||
def newWorker = new DownloadWorker(destination)
|
if (worker.currentState == WorkerState.FINISHED) {
|
||||||
activeWorkers.put(destination, newWorker)
|
def newWorker = new DownloadWorker(destination)
|
||||||
executorService.submit(newWorker)
|
activeWorkers.put(destination, newWorker)
|
||||||
|
executorService.submit(newWorker)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
worker = new DownloadWorker(destination)
|
||||||
|
activeWorkers.put(destination, worker)
|
||||||
|
executorService.submit(worker)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
worker = new DownloadWorker(destination)
|
|
||||||
activeWorkers.put(destination, worker)
|
|
||||||
executorService.submit(worker)
|
|
||||||
}
|
}
|
||||||
}
|
} as Runnable
|
||||||
}
|
}
|
||||||
|
|
||||||
void addSource(Destination d) {
|
void addSource(Destination d) {
|
||||||
|
|
|
@ -340,8 +340,8 @@ class MainFrameModel {
|
||||||
if (state == Downloader.DownloadState.FAILED ||
|
if (state == Downloader.DownloadState.FAILED ||
|
||||||
state == Downloader.DownloadState.DOWNLOADING)
|
state == Downloader.DownloadState.DOWNLOADING)
|
||||||
it.downloader.resume()
|
it.downloader.resume()
|
||||||
updateTablePreservingSelection("downloads-table")
|
|
||||||
}
|
}
|
||||||
|
updateTablePreservingSelection("downloads-table")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -654,7 +654,7 @@ class MainFrameModel {
|
||||||
|
|
||||||
results.values().each { MVCGroup group ->
|
results.values().each { MVCGroup group ->
|
||||||
if (group.alive) {
|
if (group.alive) {
|
||||||
group.view.pane.getClientProperty("results-table")?.model.fireTableDataChanged()
|
group.view.refreshResults()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue