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

Unified Diff: net/url_request/url_request_throttler_entry.cc

Issue 10173005: BackoffEntry: Add the option to always use a delay. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Remove expects failing on trybots due to roundoff Created 8 years, 8 months 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 side-by-side diff with in-line comments
Download patch
Index: net/url_request/url_request_throttler_entry.cc
===================================================================
--- net/url_request/url_request_throttler_entry.cc (revision 133742)
+++ net/url_request/url_request_throttler_entry.cc (working copy)
@@ -39,7 +39,7 @@
// avoid false positives. It should help avoid back-off from kicking in e.g.
// on flaky connections.
const int URLRequestThrottlerEntry::kDefaultNumErrorsToIgnore = 2;
-const int URLRequestThrottlerEntry::kDefaultInitialBackoffMs = 700;
+const int URLRequestThrottlerEntry::kDefaultInitialDelayMs = 700;
const double URLRequestThrottlerEntry::kDefaultMultiplyFactor = 1.4;
const double URLRequestThrottlerEntry::kDefaultJitterFactor = 0.4;
const int URLRequestThrottlerEntry::kDefaultMaximumBackoffMs = 15 * 60 * 1000;
@@ -116,12 +116,13 @@
DCHECK(manager_);
Initialize();
- backoff_policy_.initial_backoff_ms = initial_backoff_ms;
+ backoff_policy_.initial_delay_ms = initial_backoff_ms;
backoff_policy_.multiply_factor = multiply_factor;
backoff_policy_.jitter_factor = jitter_factor;
backoff_policy_.maximum_backoff_ms = maximum_backoff_ms;
backoff_policy_.entry_lifetime_ms = -1;
backoff_policy_.num_errors_to_ignore = 0;
+ backoff_policy_.always_use_initial_delay = false;
}
bool URLRequestThrottlerEntry::IsEntryOutdated() const {
@@ -163,8 +164,7 @@
GetBackoffEntry()->ShouldRejectRequest()) {
int num_failures = GetBackoffEntry()->failure_count();
int release_after_ms =
- (GetBackoffEntry()->GetReleaseTime() - base::TimeTicks::Now())
- .InMilliseconds();
+ GetBackoffEntry()->GetTimeUntilRelease().InMilliseconds();
net_log_.AddEvent(
NetLog::TYPE_THROTTLING_REJECTED_REQUEST,
@@ -271,11 +271,12 @@
void URLRequestThrottlerEntry::Initialize() {
sliding_window_release_time_ = base::TimeTicks::Now();
backoff_policy_.num_errors_to_ignore = kDefaultNumErrorsToIgnore;
- backoff_policy_.initial_backoff_ms = kDefaultInitialBackoffMs;
+ backoff_policy_.initial_delay_ms = kDefaultInitialDelayMs;
backoff_policy_.multiply_factor = kDefaultMultiplyFactor;
backoff_policy_.jitter_factor = kDefaultJitterFactor;
backoff_policy_.maximum_backoff_ms = kDefaultMaximumBackoffMs;
backoff_policy_.entry_lifetime_ms = kDefaultEntryLifetimeMs;
+ backoff_policy_.always_use_initial_delay = false;
// We pretend we just had a successful response so that we have a
// starting point to our tracking. This is called from the

Powered by Google App Engine
This is Rietveld 408576698