| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 package retry | 5 package retry |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "time" | 8 "time" |
| 9 ) | 9 ) |
| 10 | 10 |
| 11 // defaultIterator defines a template for the default retry parameters that | 11 // defaultIterator defines a template for the default retry parameters that |
| 12 // should be used throughout the program. | 12 // should be used throughout the program. |
| 13 var defaultIteratorTemplate = ExponentialBackoff{ | 13 var defaultIteratorTemplate = ExponentialBackoff{ |
| 14 Limited: Limited{ | 14 Limited: Limited{ |
| 15 Delay: 200 * time.Millisecond, | 15 Delay: 200 * time.Millisecond, |
| 16 Retries: 10, | 16 Retries: 10, |
| 17 }, | 17 }, |
| 18 MaxDelay: 10 * time.Second, | 18 MaxDelay: 10 * time.Second, |
| 19 Multiplier: 2, | 19 Multiplier: 2, |
| 20 } | 20 } |
| 21 | 21 |
| 22 // Default returns a new instance of the default iterator configuration. | 22 // Default is a Generator that returns a new instance of the default iterator |
| 23 // configuration. |
| 23 func Default() Iterator { | 24 func Default() Iterator { |
| 24 it := defaultIteratorTemplate | 25 it := defaultIteratorTemplate |
| 25 return &it | 26 return &it |
| 26 } | 27 } |
| OLD | NEW |