| Index: components/offline_pages/background/offliner_policy.h
|
| diff --git a/components/offline_pages/background/offliner_policy.h b/components/offline_pages/background/offliner_policy.h
|
| index d3424f39eb7a7b53e568fb8b75789655a990a8dc..d36de2b07ffd9bcfd3a3792a8fae576ef95992b3 100644
|
| --- a/components/offline_pages/background/offliner_policy.h
|
| +++ b/components/offline_pages/background/offliner_policy.h
|
| @@ -8,10 +8,23 @@
|
| namespace {
|
| const int kMaxStartedTries = 4;
|
| const int kMaxCompletedTries = 1;
|
| -const int kDefaultBackgroundProcessingTimeBudgetSeconds = 170;
|
| -const int kSinglePageTimeLimitWhenBackgroundScheduledSeconds = 120;
|
| -const int kSinglePageTimeLimitForImmediateLoadSeconds = 300;
|
| const int kRequestExpirationTimeInSeconds = 60 * 60 * 24 * 7;
|
| +
|
| +// Scheduled background processing time limits.
|
| +const int kDozeModeBackgroundServiceWindowSeconds = 60 * 3;
|
| +const int kDefaultBackgroundProcessingTimeBudgetSeconds =
|
| + kDozeModeBackgroundServiceWindowSeconds - 10;
|
| +const int kSinglePageTimeLimitWhenBackgroundScheduledSeconds =
|
| + kDozeModeBackgroundServiceWindowSeconds - 10;
|
| +
|
| +// Immediate processing time limits.
|
| +// Note: experiments on GIN-2g-poor show many page requests took 3 or 4
|
| +// attempts in background scheduled mode with timeout of 2 minutes. So for
|
| +// immediate processing mode, give page requests 4 times that limit (8 min).
|
| +// Then budget up to 5 of those requests in processing window.
|
| +const int kSinglePageTimeLimitForImmediateLoadSeconds = 60 * 8;
|
| +const int kImmediateLoadProcessingTimeBudgetSeconds =
|
| + kSinglePageTimeLimitForImmediateLoadSeconds * 5;
|
| } // namespace
|
|
|
| namespace offline_pages {
|
| @@ -26,7 +39,7 @@ class OfflinerPolicy {
|
| retry_count_is_more_important_than_recency_(false),
|
| max_started_tries_(kMaxStartedTries),
|
| max_completed_tries_(kMaxCompletedTries),
|
| - background_processing_time_budget_(
|
| + background_scheduled_processing_time_budget_(
|
| kDefaultBackgroundProcessingTimeBudgetSeconds) {}
|
|
|
| // Constructor for unit tests.
|
| @@ -41,7 +54,8 @@ class OfflinerPolicy {
|
| retry_count_is_more_important_than_recency_(prefer_retry_count),
|
| max_started_tries_(max_started_tries),
|
| max_completed_tries_(max_completed_tries),
|
| - background_processing_time_budget_(background_processing_time_budget) {}
|
| + background_scheduled_processing_time_budget_(
|
| + background_processing_time_budget) {}
|
|
|
| // TODO(petewil): Numbers here are chosen arbitrarily, do the proper studies
|
| // to get good policy numbers. Eventually this should get data from a finch
|
| @@ -85,10 +99,18 @@ class OfflinerPolicy {
|
| return 25;
|
| }
|
|
|
| - // How many seconds to keep trying new pages for, before we give up, and
|
| + // How many seconds to keep trying new pages for, before we give up, and
|
| // return to the scheduler.
|
| - int GetBackgroundProcessingTimeBudgetSeconds() const {
|
| - return background_processing_time_budget_;
|
| + // TODO(dougarnett): Consider parameterizing these time limit/budget
|
| + // calls with processing mode.
|
| + int GetProcessingTimeBudgetWhenBackgroundScheduledInSeconds() const {
|
| + return background_scheduled_processing_time_budget_;
|
| + }
|
| +
|
| + // How many seconds to keep trying new pages for, before we give up, when
|
| + // processing started immediately (without scheduler).
|
| + int GetProcessingTimeBudgetForImmediateLoadInSeconds() const {
|
| + return kImmediateLoadProcessingTimeBudgetSeconds;
|
| }
|
|
|
| // How long do we allow a page to load before giving up on it when
|
| @@ -114,7 +136,7 @@ class OfflinerPolicy {
|
| bool retry_count_is_more_important_than_recency_;
|
| int max_started_tries_;
|
| int max_completed_tries_;
|
| - int background_processing_time_budget_;
|
| + int background_scheduled_processing_time_budget_;
|
| };
|
| } // namespace offline_pages
|
|
|
|
|