constrain multi-downloader to 1-12 threads
This commit is contained in:
@@ -784,8 +784,9 @@ import okhttp3.HttpUrl;
|
|||||||
|
|
||||||
protected Error.Type downloadSceneFile(Job ajob_) throws SheepItException {
|
protected Error.Type downloadSceneFile(Job ajob_) throws SheepItException {
|
||||||
int total = ajob_.getArchiveChunks().size();
|
int total = ajob_.getArchiveChunks().size();
|
||||||
|
int threads = Math.max(1, Math.min(total, 12)); // at least one thread, to avoid IllegalArgumentException if total = 0
|
||||||
|
|
||||||
ExecutorService executor = Executors.newFixedThreadPool(total);
|
ExecutorService executor = Executors.newFixedThreadPool(threads);
|
||||||
ArrayList<Callable<Error.Type>> tasks = new ArrayList<>();
|
ArrayList<Callable<Error.Type>> tasks = new ArrayList<>();
|
||||||
|
|
||||||
this.gui.getDownloadProgress().reset("Downloading project");
|
this.gui.getDownloadProgress().reset("Downloading project");
|
||||||
|
|||||||
Reference in New Issue
Block a user