constrain multi-downloader to 1-12 threads

This commit is contained in:
M*C*O
2024-04-30 16:56:29 +00:00
committed by harlekin
parent 5aaa88cf1a
commit 85ee7e4d42

View File

@@ -784,8 +784,9 @@ import okhttp3.HttpUrl;
protected Error.Type downloadSceneFile(Job ajob_) throws SheepItException {
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<>();
this.gui.getDownloadProgress().reset("Downloading project");