Merge pull request #3949 from ByteHamster/fix-downloads-taking-long

Fixed downloads taking long before being shown as started
This commit is contained in:
H. Lehmann 2020-03-20 18:54:23 +01:00 committed by GitHub
commit 945224f308
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -474,7 +474,6 @@ public class DownloadService extends Service {
@NonNull List<? extends FeedItem> itemsEnqueued) {
writeFileUrl(request);
ClientConfig.installSslProvider(this);
Downloader downloader = downloaderFactory.create(request);
if (downloader != null) {
numberOfDownloads.incrementAndGet();
@ -485,9 +484,12 @@ public class DownloadService extends Service {
}
handler.post(() -> {
downloads.add(downloader);
downloadExecutor.submit(downloader);
postDownloaders();
});
// Needs to be done after postDownloaders() because otherwise,
// it might take long before the progress bar circle starts spinning
ClientConfig.installSslProvider(this);
handler.post(() -> downloadExecutor.submit(downloader));
}
handler.post(this::queryDownloads);
}