diff options
author | Ilya Grechuhin <i.grechuhin@gmail.com> | 2016-06-09 16:29:56 +0300 |
---|---|---|
committer | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2016-06-23 19:23:38 +0300 |
commit | 990a620d5ef477b7d926b9294c5bb574a158058b (patch) | |
tree | b0b777b7cc922edb9b5c409f12d67156e5a59942 /storage | |
parent | 880c87794982f438459aac57901aa4c8a3ffdca2 (diff) |
[downloader] Updated downloading policy.
Added info about last auto retry download failed.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/downloading_policy.cpp | 3 | ||||
-rw-r--r-- | storage/downloading_policy.hpp | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/storage/downloading_policy.cpp b/storage/downloading_policy.cpp index 6903a778d1..0d9cc2098d 100644 --- a/storage/downloading_policy.cpp +++ b/storage/downloading_policy.cpp @@ -13,6 +13,7 @@ void StorageDownloadingPolicy::ScheduleRetry(storage::TCountriesSet const & fail { if (IsDownloadingAllowed() && !failedCountries.empty() && m_autoRetryCounter > 0) { + m_downloadRetryFailed = false; auto action = [this, func, failedCountries] { --m_autoRetryCounter; @@ -22,6 +23,8 @@ void StorageDownloadingPolicy::ScheduleRetry(storage::TCountriesSet const & fail } else { + if(!failedCountries.empty()) + m_downloadRetryFailed = true; m_autoRetryCounter = kAutoRetryCounterMax; } } diff --git a/storage/downloading_policy.hpp b/storage/downloading_policy.hpp index 9b72c56941..5f9df010c1 100644 --- a/storage/downloading_policy.hpp +++ b/storage/downloading_policy.hpp @@ -18,6 +18,7 @@ public: class StorageDownloadingPolicy : public DownloadingPolicy { bool m_cellularDownloadEnabled = false; + bool m_downloadRetryFailed = false; static size_t constexpr kAutoRetryCounterMax = 3; size_t m_autoRetryCounter = kAutoRetryCounterMax; my::DeferredTask m_autoRetryWorker; @@ -27,7 +28,7 @@ public: inline void EnableCellularDownload(bool value) { m_cellularDownloadEnabled = value; } inline bool IsCellularDownloadEnabled() const { return m_cellularDownloadEnabled; } - inline bool IsAutoRetryDownloadFailed() const { return m_autoRetryCounter == 0; } + inline bool IsAutoRetryDownloadFailed() const { return m_downloadRetryFailed || m_autoRetryCounter == 0; } bool IsDownloadingAllowed() const override; void ScheduleRetry(storage::TCountriesSet const & failedCountries, TProcessFunc const & func) override; |