PM: UpdaterProvider reports the number of consecutive failed update checks.
This adds a new variable to UpdaterProvider, along with the necessary
bits of implementation in UpdateAttempter, to track and report this
number.
BUG=chromium:367006
TEST=Unit tests.
Change-Id: I819dc5c9d4d351e5bfe1373dba0993e3f622b0e0
Reviewed-on: https://chromium-review.googlesource.com/197092
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/update_attempter.cc b/update_attempter.cc
index 891cc96..7df18b1 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -978,6 +978,15 @@
// If the request is not an event, then it's the update-check.
if (!omaha_request_action->IsEvent()) {
http_response_code_ = omaha_request_action->GetHTTPResponseCode();
+
+ // Record the number of consecutive failed update checks.
+ if (http_response_code_ == kHttpResponseInternalServerError ||
+ http_response_code_ == kHttpResponseServiceUnavailable) {
+ consecutive_failed_update_checks_++;
+ } else {
+ consecutive_failed_update_checks_ = 0;
+ }
+
// Forward the server-dictated poll interval to the update check
// scheduler, if any.
if (update_check_scheduler_) {