additional logging for #6201

This commit is contained in:
madwasp79 2019-06-28 15:52:34 +03:00
parent 10dd9ff2d7
commit b09412b6ed

View file

@ -85,6 +85,7 @@ public class PerformLiveUpdateAsyncTask
settings.LIVE_UPDATES_RETRIES.resetToDefault(); settings.LIVE_UPDATES_RETRIES.resetToDefault();
List<IncrementalChangesManager.IncrementalUpdate> ll = result.getItemsForUpdate(); List<IncrementalChangesManager.IncrementalUpdate> ll = result.getItemsForUpdate();
if (ll != null && !ll.isEmpty()) { if (ll != null && !ll.isEmpty()) {
LOG.debug("Updates quantity: " + ll.size());
ArrayList<IndexItem> itemsToDownload = new ArrayList<>(ll.size()); ArrayList<IndexItem> itemsToDownload = new ArrayList<>(ll.size());
for (IncrementalChangesManager.IncrementalUpdate iu : ll) { for (IncrementalChangesManager.IncrementalUpdate iu : ll) {
IndexItem indexItem = new IndexItem(iu.fileName, "Incremental update", IndexItem indexItem = new IndexItem(iu.fileName, "Incremental update",
@ -92,12 +93,16 @@ public class PerformLiveUpdateAsyncTask
iu.containerSize, DownloadActivityType.LIVE_UPDATES_FILE); iu.containerSize, DownloadActivityType.LIVE_UPDATES_FILE);
itemsToDownload.add(indexItem); itemsToDownload.add(indexItem);
} }
LOG.debug("Items to download size: " + itemsToDownload.size());
DownloadIndexesThread downloadThread = application.getDownloadThread(); DownloadIndexesThread downloadThread = application.getDownloadThread();
if (context instanceof DownloadIndexesThread.DownloadEvents) { if (context instanceof DownloadIndexesThread.DownloadEvents) {
downloadThread.setUiActivity((DownloadIndexesThread.DownloadEvents) context); downloadThread.setUiActivity((DownloadIndexesThread.DownloadEvents) context);
} }
boolean downloadViaWiFi = boolean downloadViaWiFi =
LiveUpdatesHelper.preferenceDownloadViaWiFi(localIndexFileName, settings).get(); LiveUpdatesHelper.preferenceDownloadViaWiFi(localIndexFileName, settings).get();
LOG.debug("Internet connection available: " + getMyApplication().getSettings().isInternetConnectionAvailable());
LOG.debug("Download via Wifi: " + downloadViaWiFi);
if (getMyApplication().getSettings().isInternetConnectionAvailable()) { if (getMyApplication().getSettings().isInternetConnectionAvailable()) {
if (userRequested || settings.isWifiConnected() || !downloadViaWiFi) { if (userRequested || settings.isWifiConnected() || !downloadViaWiFi) {
long szLong = 0; long szLong = 0;
@ -113,6 +118,8 @@ public class PerformLiveUpdateAsyncTask
double sz = ((double) szLong) / (1 << 20); double sz = ((double) szLong) / (1 << 20);
// get availabile space // get availabile space
double asz = downloadThread.getAvailableSpace(); double asz = downloadThread.getAvailableSpace();
LOG.debug("Download size: " + sz + ", available space: " + asz);
if (asz == -1 || asz <= 0 || sz / asz <= 0.4) { if (asz == -1 || asz <= 0 || sz / asz <= 0.4) {
IndexItem[] itemsArray = new IndexItem[itemsToDownload.size()]; IndexItem[] itemsArray = new IndexItem[itemsToDownload.size()];
itemsArray = itemsToDownload.toArray(itemsArray); itemsArray = itemsToDownload.toArray(itemsArray);
@ -120,8 +127,10 @@ public class PerformLiveUpdateAsyncTask
if (context instanceof DownloadIndexesThread.DownloadEvents) { if (context instanceof DownloadIndexesThread.DownloadEvents) {
((DownloadIndexesThread.DownloadEvents) context).downloadInProgress(); ((DownloadIndexesThread.DownloadEvents) context).downloadInProgress();
} }
} else {
LOG.debug("onPostExecute: Not enough space for updates");
} }
} } LOG.debug("onPostExecute: No internet connection");
} }
} else { } else {
if (context instanceof DownloadIndexesThread.DownloadEvents) { if (context instanceof DownloadIndexesThread.DownloadEvents) {