Merge branch 'download-threads' into 'master'

constrain multi-downloader to 1-12 threads

See merge request sheepitrenderfarm/client!303
This commit is contained in:
harlekin
2024-04-30 16:56:29 +00:00

View File

@@ -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");