diff options
author | Tom Hennen <TomHennen@users.noreply.github.com> | 2016-01-23 10:04:28 -0500 |
---|---|---|
committer | Tom Hennen <TomHennen@users.noreply.github.com> | 2016-01-23 10:04:28 -0500 |
commit | 932620e73ccfbdceacdd87ab3b222fcb93435ce8 (patch) | |
tree | d65045126be2201124a7685e4ea8e6e54b99e31a /core/src | |
parent | c0884f72d8663e136d327eb8b06f7df1f5178aed (diff) | |
parent | 6ec174e0fbda3ebec087af7ca4773cdf39e68f98 (diff) | |
download | AntennaPod-932620e73ccfbdceacdd87ab3b222fcb93435ce8.zip |
Merge pull request #1567 from mfietz/issue/1296-dl-retry-loop-no-space
Avoid download retry loop when storage is full
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java | 6 | ||||
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java | 3 |
2 files changed, 4 insertions, 5 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java index ed4377a72..d69228ceb 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java @@ -204,8 +204,10 @@ public class DownloadService extends Service { return; } FeedItem item = media.getItem(); - if (status.getReason() == DownloadError.ERROR_HTTP_DATA_ERROR && - Integer.valueOf(status.getReasonDetailed()) == HttpURLConnection.HTTP_NOT_FOUND) { + boolean httpNotFound = status.getReason() == DownloadError.ERROR_HTTP_DATA_ERROR + && String.valueOf(HttpURLConnection.HTTP_NOT_FOUND).equals(status.getReasonDetailed()); + boolean notEnoughSpace = status.getReason() == DownloadError.ERROR_NOT_ENOUGH_SPACE; + if (httpNotFound || notEnoughSpace) { DBWriter.saveFeedItemAutoDownloadFailed(item).get(); } // to make lists reload the failed item, we fake an item update diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java index d1d6bd750..e728abc3b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java @@ -993,7 +993,6 @@ public class DBWriter { public static Future<?> saveFeedItemAutoDownloadFailed(final FeedItem feedItem) { return dbExec.submit(() -> { int failedAttempts = feedItem.getFailedAutoDownloadAttempts() + 1; - Log.d(TAG, "failedAttempts: " + failedAttempts); long autoDownload; if(!feedItem.getAutoDownload() || failedAttempts >= 10) { autoDownload = 0; // giving up, disable auto download @@ -1001,8 +1000,6 @@ public class DBWriter { } else { long now = System.currentTimeMillis(); autoDownload = (now / 10) * 10 + failedAttempts; - Log.d(TAG, "now: " + now); - Log.d(TAG, "autoDownload: " + autoDownload); } final PodDBAdapter adapter = PodDBAdapter.getInstance(); adapter.open(); |