Chromium Code Reviews| Index: net/base/backoff_entry.cc |
| diff --git a/net/base/backoff_entry.cc b/net/base/backoff_entry.cc |
| index 44bae52731b2cd998295a8c37d0b22631975aa59..092be183ab459901ab6c8b0b2e706f2d4125a745 100644 |
| --- a/net/base/backoff_entry.cc |
| +++ b/net/base/backoff_entry.cc |
| @@ -29,22 +29,12 @@ BackoffEntry::~BackoffEntry() { |
| void BackoffEntry::InformOfRequest(bool succeeded) { |
| if (!succeeded) { |
| - failure_count_++; |
| - exponential_backoff_release_time_ = CalculateReleaseTime(); |
| + ++failure_count_; |
| } else { |
| - failure_count_ = 0; |
| - |
| - // The reason why we are not just cutting the release time to GetTimeNow() |
| - // is on the one hand, it would unset a release time set by |
| - // SetCustomReleaseTime and on the other we would like to push every |
| - // request up to our "horizon" when dealing with multiple in-flight |
| - // requests. Ex: If we send three requests and we receive 2 failures and |
| - // 1 success. The success that follows those failures will not reset the |
| - // release time, further requests will then need to wait the delay caused |
| - // by the 2 failures. |
| - exponential_backoff_release_time_ = std::max( |
| - GetTimeNow(), exponential_backoff_release_time_); |
| + failure_count_ = std::max(0, --failure_count_); |
| } |
| + |
| + exponential_backoff_release_time_ = CalculateReleaseTime(); |
|
sanjeevr
2011/05/04 18:51:50
I don't know the code well enough to tell if calli
Jói
2011/05/04 20:04:29
Nope, it's a small bug to call it in the success c
|
| } |
| bool BackoffEntry::ShouldRejectRequest() const { |
| @@ -110,7 +100,9 @@ base::TimeTicks BackoffEntry::CalculateReleaseTime() const { |
| static_cast<int64>(policy_->maximum_backoff_ms)); |
| // Never reduce previously set release horizon, e.g. due to Retry-After |
| - // header. |
| + // header. To clarify, the delay we are adding may have been reduced (if |
| + // the failure count was decreased from its previous value) but the absolute |
| + // time of the release horizon should not be moved forward. |
| return std::max(GetTimeNow() + base::TimeDelta::FromMilliseconds(delay_int), |
| exponential_backoff_release_time_); |
| } |