@@ -20,16 +20,16 @@ pub enum RetryResult<T> {
20
20
}
21
21
22
22
/// Maximum amount of time a single retry can be delayed (milliseconds).
23
- const MAX_RETRY_SLEEP : u64 = 10 * 1000 ;
23
+ const MAX_RETRY_SLEEP_MS : u64 = 10 * 1000 ;
24
24
/// The minimum initial amount of time a retry will be delayed (milliseconds).
25
25
///
26
26
/// The actual amount of time will be a random value above this.
27
- const INITIAL_RETRY_SLEEP_BASE : u64 = 500 ;
27
+ const INITIAL_RETRY_SLEEP_BASE_MS : u64 = 500 ;
28
28
/// The maximum amount of additional time the initial retry will take (milliseconds).
29
29
///
30
- /// The initial delay will be [`INITIAL_RETRY_SLEEP_BASE `] plus a random range
30
+ /// The initial delay will be [`INITIAL_RETRY_SLEEP_BASE_MS `] plus a random range
31
31
/// from 0 to this value.
32
- const INITIAL_RETRY_JITTER : u64 = 1000 ;
32
+ const INITIAL_RETRY_JITTER_MS : u64 = 1000 ;
33
33
34
34
impl < ' a > Retry < ' a > {
35
35
pub fn new ( config : & ' a Config ) -> CargoResult < Retry < ' a > > {
@@ -55,11 +55,11 @@ impl<'a> Retry<'a> {
55
55
self . retries += 1 ;
56
56
let sleep = if self . retries == 1 {
57
57
let mut rng = rand:: thread_rng ( ) ;
58
- INITIAL_RETRY_SLEEP_BASE + rng. gen_range ( 0 ..INITIAL_RETRY_JITTER )
58
+ INITIAL_RETRY_SLEEP_BASE_MS + rng. gen_range ( 0 ..INITIAL_RETRY_JITTER_MS )
59
59
} else {
60
60
min (
61
- ( ( self . retries - 1 ) * 3 ) * 1000 + INITIAL_RETRY_SLEEP_BASE ,
62
- MAX_RETRY_SLEEP ,
61
+ ( ( self . retries - 1 ) * 3 ) * 1000 + INITIAL_RETRY_SLEEP_BASE_MS ,
62
+ MAX_RETRY_SLEEP_MS ,
63
63
)
64
64
} ;
65
65
RetryResult :: Retry ( sleep)
@@ -208,8 +208,8 @@ fn default_retry_schedule() {
208
208
match retry. r#try ( || spurious ( ) ) {
209
209
RetryResult :: Retry ( sleep) => {
210
210
assert ! (
211
- sleep >= INITIAL_RETRY_SLEEP_BASE
212
- && sleep < INITIAL_RETRY_SLEEP_BASE + INITIAL_RETRY_JITTER
211
+ sleep >= INITIAL_RETRY_SLEEP_BASE_MS
212
+ && sleep < INITIAL_RETRY_SLEEP_BASE_MS + INITIAL_RETRY_JITTER_MS
213
213
) ;
214
214
}
215
215
_ => panic ! ( "unexpected non-retry" ) ,
0 commit comments