Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: components/offline_pages/background/offliner_policy.h

Issue 2472593002: Add retries for completed background loading attempts (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/offline_pages/background/request_coordinator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_ 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_
7 7
8 namespace { 8 namespace {
9 // The max number of started tries is to guard against pages that make the
10 // prerenderer crash. It should be greater than or equal to the max number of
11 // completed tries.
9 const int kMaxStartedTries = 4; 12 const int kMaxStartedTries = 4;
10 const int kMaxCompletedTries = 1; 13 // The number of max completed tries is based on Gin2G-poor testing showing that
14 // we often need about 4 retries with a 2 minute window, or 3 retries with a 3
dougarnett 2016/11/02 19:28:11 retries => tries here?
Pete Williamson 2016/11/03 18:34:08 Done.
15 // minute window.
16 const int kMaxCompletedTries = 3;
17 // By the time we get to a week, the user has forgotten asking for a page.
11 const int kRequestExpirationTimeInSeconds = 60 * 60 * 24 * 7; 18 const int kRequestExpirationTimeInSeconds = 60 * 60 * 24 * 7;
12 19
13 // Scheduled background processing time limits. 20 // Scheduled background processing time limits.
14 const int kDozeModeBackgroundServiceWindowSeconds = 60 * 3; 21 const int kDozeModeBackgroundServiceWindowSeconds = 60 * 3;
15 const int kDefaultBackgroundProcessingTimeBudgetSeconds = 22 const int kDefaultBackgroundProcessingTimeBudgetSeconds =
16 kDozeModeBackgroundServiceWindowSeconds - 10; 23 kDozeModeBackgroundServiceWindowSeconds - 10;
17 const int kSinglePageTimeLimitWhenBackgroundScheduledSeconds = 24 const int kSinglePageTimeLimitWhenBackgroundScheduledSeconds =
18 kDozeModeBackgroundServiceWindowSeconds - 10; 25 kDozeModeBackgroundServiceWindowSeconds - 10;
19 26
20 // Immediate processing time limits. 27 // Immediate processing time limits.
21 // Note: experiments on GIN-2g-poor show many page requests took 3 or 4 28 // Note: experiments on GIN-2g-poor show many page requests took 3 or 4
22 // attempts in background scheduled mode with timeout of 2 minutes. So for 29 // attempts in background scheduled mode with timeout of 2 minutes. So for
23 // immediate processing mode, give page requests 4 times that limit (8 min). 30 // immediate processing mode, give page requests 4 times that limit (8 min).
24 // Then budget up to 5 of those requests in processing window. 31 // Then budget up to 5 of those requests in processing window.
25 const int kSinglePageTimeLimitForImmediateLoadSeconds = 60 * 8; 32 const int kSinglePageTimeLimitForImmediateLoadSeconds = 60 * 8;
26 const int kImmediateLoadProcessingTimeBudgetSeconds = 33 const int kImmediateLoadProcessingTimeBudgetSeconds =
27 kSinglePageTimeLimitForImmediateLoadSeconds * 5; 34 kSinglePageTimeLimitForImmediateLoadSeconds * 5;
28 } // namespace 35 } // namespace
29 36
30 namespace offline_pages { 37 namespace offline_pages {
31 38
32 // Policy for the Background Offlining system. Some policy will belong to the 39 // Policy for the Background Offlining system. Some policy will belong to the
33 // RequestCoordinator, some to the RequestQueue, and some to the Offliner. 40 // RequestCoordinator, some to the RequestQueue, and some to the Offliner.
34 class OfflinerPolicy { 41 class OfflinerPolicy {
35 public: 42 public:
36 OfflinerPolicy() 43 OfflinerPolicy()
37 : prefer_untried_requests_(false), 44 : prefer_untried_requests_(true),
38 prefer_earlier_requests_(true), 45 prefer_earlier_requests_(true),
39 retry_count_is_more_important_than_recency_(false), 46 retry_count_is_more_important_than_recency_(true),
40 max_started_tries_(kMaxStartedTries), 47 max_started_tries_(kMaxStartedTries),
41 max_completed_tries_(kMaxCompletedTries), 48 max_completed_tries_(kMaxCompletedTries),
42 background_scheduled_processing_time_budget_( 49 background_scheduled_processing_time_budget_(
43 kDefaultBackgroundProcessingTimeBudgetSeconds) {} 50 kDefaultBackgroundProcessingTimeBudgetSeconds) {}
44 51
45 // Constructor for unit tests. 52 // Constructor for unit tests.
46 OfflinerPolicy(bool prefer_untried, 53 OfflinerPolicy(bool prefer_untried,
47 bool prefer_earlier, 54 bool prefer_earlier,
48 bool prefer_retry_count, 55 bool prefer_retry_count,
49 int max_started_tries, 56 int max_started_tries,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 bool prefer_earlier_requests_; 142 bool prefer_earlier_requests_;
136 bool retry_count_is_more_important_than_recency_; 143 bool retry_count_is_more_important_than_recency_;
137 int max_started_tries_; 144 int max_started_tries_;
138 int max_completed_tries_; 145 int max_completed_tries_;
139 int background_scheduled_processing_time_budget_; 146 int background_scheduled_processing_time_budget_;
140 }; 147 };
141 } // namespace offline_pages 148 } // namespace offline_pages
142 149
143 150
144 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_ 151 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_
OLDNEW
« no previous file with comments | « no previous file | components/offline_pages/background/request_coordinator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698