Fixed downloads taking long before being shown as started

The first call to installSslProvider may take quite long.
Already report the started download.
This commit is contained in:
ByteHamster 2020-03-20 18:09:27 +01:00
parent 4da4b0e1c2
commit 000ea0b6de
1 changed files with 4 additions and 2 deletions

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);
}