@@ -3,17 +3,15 @@ use crate::db::{delete_crate, Pool};
3
3
use crate :: docbuilder:: PackageKind ;
4
4
use crate :: error:: Result ;
5
5
use crate :: storage:: Storage ;
6
- use crate :: utils:: { get_config, get_crate_priority, report_error, set_config, ConfigName } ;
6
+ use crate :: utils:: { get_config, get_crate_priority, report_error, retry , set_config, ConfigName } ;
7
7
use crate :: { Config , Index , Metrics , RustwideBuilder } ;
8
8
use anyhow:: Context ;
9
9
use fn_error_context:: context;
10
10
11
- use tracing:: { debug, error, info, warn } ;
11
+ use tracing:: { debug, error, info} ;
12
12
13
13
use std:: collections:: HashMap ;
14
14
use std:: sync:: Arc ;
15
- use std:: thread;
16
- use std:: time:: Duration ;
17
15
18
16
#[ derive( Debug , Clone , Eq , PartialEq , serde:: Serialize ) ]
19
17
pub ( crate ) struct QueuedCrate {
@@ -262,27 +260,6 @@ impl BuildQueue {
262
260
}
263
261
}
264
262
265
- fn retry < T > ( mut f : impl FnMut ( ) -> Result < T > , max_attempts : u32 ) -> Result < T > {
266
- for attempt in 1 .. {
267
- match f ( ) {
268
- Ok ( result) => return Ok ( result) ,
269
- Err ( err) => {
270
- if attempt > max_attempts {
271
- return Err ( err) ;
272
- } else {
273
- let sleep_for = 2u32 . pow ( attempt) ;
274
- warn ! (
275
- "got error on attempt {}, will try again after {}s:\n {:?}" ,
276
- attempt, sleep_for, err
277
- ) ;
278
- thread:: sleep ( Duration :: from_secs ( sleep_for as u64 ) ) ;
279
- }
280
- }
281
- }
282
- }
283
- unreachable ! ( )
284
- }
285
-
286
263
/// Index methods.
287
264
impl BuildQueue {
288
265
/// Updates registry index repository and adds new crates into build queue.
0 commit comments