OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "components/domain_reliability/scheduler.h" | 5 #include "components/domain_reliability/scheduler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 VLOG(1) << "Upload to collector " << collector_index_ | 134 VLOG(1) << "Upload to collector " << collector_index_ |
135 << (result.is_success() ? " succeeded." : " failed."); | 135 << (result.is_success() ? " succeeded." : " failed."); |
136 | 136 |
137 net::BackoffEntry* backoff = collectors_[collector_index_]; | 137 net::BackoffEntry* backoff = collectors_[collector_index_]; |
138 collector_index_ = kInvalidCollectorIndex; | 138 collector_index_ = kInvalidCollectorIndex; |
139 | 139 |
140 backoff->InformOfRequest(result.is_success()); | 140 backoff->InformOfRequest(result.is_success()); |
141 if (result.is_retry_after()) | 141 if (result.is_retry_after()) |
142 backoff->SetCustomReleaseTime(time_->NowTicks() + result.retry_after); | 142 backoff->SetCustomReleaseTime(time_->NowTicks() + result.retry_after); |
| 143 last_collector_retry_delay_ = backoff->GetTimeUntilRelease(); |
143 | 144 |
144 if (!result.is_success()) { | 145 if (!result.is_success()) { |
145 // Restore upload_pending_ and first_beacon_time_ to pre-upload state, | 146 // Restore upload_pending_ and first_beacon_time_ to pre-upload state, |
146 // since upload failed. | 147 // since upload failed. |
147 upload_pending_ = true; | 148 upload_pending_ = true; |
148 first_beacon_time_ = old_first_beacon_time_; | 149 first_beacon_time_ = old_first_beacon_time_; |
149 } | 150 } |
150 | 151 |
151 last_upload_end_time_ = time_->NowTicks(); | 152 last_upload_end_time_ = time_->NowTicks(); |
152 last_upload_success_ = result.is_success(); | 153 last_upload_success_ = result.is_success(); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 min_index = i; | 258 min_index = i; |
258 } | 259 } |
259 } | 260 } |
260 | 261 |
261 DCHECK_NE(kInvalidCollectorIndex, min_index); | 262 DCHECK_NE(kInvalidCollectorIndex, min_index); |
262 *upload_time_out = min_time; | 263 *upload_time_out = min_time; |
263 *collector_index_out = min_index; | 264 *collector_index_out = min_index; |
264 } | 265 } |
265 | 266 |
266 } // namespace domain_reliability | 267 } // namespace domain_reliability |
OLD | NEW |