Chromium Code Reviews| Index: components/offline_pages/background/request_picker.cc |
| diff --git a/components/offline_pages/background/request_picker.cc b/components/offline_pages/background/request_picker.cc |
| index d6014069e8cdf746b07abe4a5dbf34ae97839563..ce9f87193f874e86b5858886686f6bea61253aa8 100644 |
| --- a/components/offline_pages/background/request_picker.cc |
| +++ b/components/offline_pages/background/request_picker.cc |
| @@ -107,11 +107,18 @@ bool RequestPicker::RequestConditionsSatisfied(const SavePageRequest& request) { |
| } |
| } |
| + // If we have already started this page the max number of times, it is not |
| + // eligible to try again. |
| + // TODO(petewil): We should have code to remove the page from the |
| + // queue after the last retry. |
| + if (request.started_attempt_count() >= policy_->GetMaxStartedTries()) |
| + return false; |
| + |
| // If we have already tried this page the max number of times, it is not |
| // eligible to try again. |
|
chili
2016/08/08 18:17:01
nit: this comment is the same as the one above. P
Pete Williamson
2016/08/08 18:44:28
comment updated.
|
| - // TODO(petewil): Instead, we should have code to remove the page from the |
| + // TODO(petewil): We should have code to remove the page from the |
| // queue after the last retry. |
| - if (request.attempt_count() > policy_->GetMaxTries()) |
| + if (request.completed_attempt_count() >= policy_->GetMaxCompletedTries()) |
| return false; |
| // If the request is expired, do not consider it. |
| @@ -187,7 +194,8 @@ bool RequestPicker::RecencyFirstCompareFunction( |
| int RequestPicker::CompareRetryCount( |
| const SavePageRequest* left, const SavePageRequest* right) { |
| // Check the attempt count. |
| - int result = signum(left->attempt_count() - right->attempt_count()); |
| + int result = signum(left->completed_attempt_count() - |
| + right->completed_attempt_count()); |
| // Flip the direction of comparison if policy prefers fewer retries. |
| if (fewer_retries_better_) |