Implement exponential backoff for throttling repeated AU downloads.
Today we retry the same payload over and over again every hour. Ideally,
we shouldn't require ever to re-download the same payload again. But
from experience we find that post-install or firmware updates may succeed
on a second attempt. So until we have code that can do such selective
retries of those steps, we currently re-download and re-apply the whole
payload. So instead of retrying over and over again, we backoff the
successive payload download attempts at 1 day, 2 days, 4 days, etc. with
an upper limit of 16 days.
Another subtle reason for which we depend on the payload retry mechanism
today is if we've failed downloading the payload via all the URLs that are
specified in the rule, we don't want to keep re-attempting the download.
This case is different from the case discussed above, because in this case
we haven't even downloaded a payload once completely. In this case also,
there's a need for throttling the amount of bytes we end up downloading
repeatedly for a particular operation that may fail. This is done by
treating the exhaustion of all URLs as equivalent to having downloaded
a full payload and subjecting it to the same backoff behavior.
We waive backoffs for dev/test images so as not to cause any delay in
our testing or development.
BUG=chromium-os:36806
TEST=Added new unit tests. Tested all scenarios on my ZGB.
Change-Id: I6bd0d3f296a3c0da0a8026fb71b24785d825e39c
Reviewed-on: https://gerrit.chromium.org/gerrit/40220
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
diff --git a/action_processor.h b/action_processor.h
index ba0e512..7c425de 100644
--- a/action_processor.h
+++ b/action_processor.h
@@ -63,10 +63,11 @@
kActionCodeOmahaErrorInHTTPResponse = 37,
kActionCodeDownloadOperationHashMissingError = 38,
kActionCodeDownloadMetadataSignatureMissingError = 39,
+ kActionCodeOmahaUpdateDeferredForBackoff = 40,
// Note: When adding new error codes, please remember to add the
// error into one of the buckets in PayloadState::UpdateFailed method so
- // that the retries across URLs and the payload back-off mechanism work
+ // that the retries across URLs and the payload backoff mechanism work
// correctly for those new error codes.
// Any code above this is sent to both Omaha and UMA as-is, except