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
3 // found in the LICENSE file.
5 #include "components/gcm_driver/gcm_backoff_policy.h"
11 // Backoff policy. Shared across GCM requests.
12 // Note: In order to ensure a minimum of 20 seconds between server errors (for
13 // server reasons), we have a 30s +- 10s (33%) jitter initial backoff.
14 const net::BackoffEntry::Policy kDefaultBackoffPolicy
= {
15 // Number of initial errors (in sequence) to ignore before applying
16 // exponential back-off rules.
19 // Initial delay for exponential back-off in ms.
20 30 * 1000, // 30 seconds.
22 // Factor by which the waiting time will be multiplied.
25 // Fuzzing percentage. ex: 10% will spread requests randomly
26 // between 90%-100% of the calculated time.
29 // Maximum amount of time we are willing to delay our request in ms.
30 10 * 60 * 1000, // 10 minutes.
32 // Time to keep an entry from being discarded even when it
33 // has no significant state, -1 to never discard.
36 // Don't use initial delay unless the last request was an error.
42 const net::BackoffEntry::Policy
& GetGCMBackoffPolicy() {
43 return kDefaultBackoffPolicy
;