File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
src/cargo/sources/registry Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -796,19 +796,22 @@ impl<'gctx> RegistryData for HttpRegistry<'gctx> {
796
796
self . downloads . blocking_calls += 1 ;
797
797
798
798
loop {
799
- self . handle_completed_downloads ( ) ?;
800
- self . add_sleepers ( ) ?;
801
-
802
799
let remaining_in_multi = tls:: set ( & self . downloads , || {
803
800
self . multi
804
801
. perform ( )
805
802
. context ( "failed to perform http requests" )
806
803
} ) ?;
807
804
trace ! ( target: "network" , "{} transfers remaining" , remaining_in_multi) ;
808
-
805
+ // Handles transfers performed by `self.multi` above and adds to
806
+ // `self.downloads.results`. Failed transfers get added to
807
+ // `self.downloads.sleeping` for retry.
808
+ self . handle_completed_downloads ( ) ?;
809
809
if remaining_in_multi + self . downloads . sleeping . len ( ) as u32 == 0 {
810
810
return Ok ( ( ) ) ;
811
811
}
812
+ // Handles failed transfers in `self.downloads.sleeping` and
813
+ // re-adds them to `self.multi`.
814
+ self . add_sleepers ( ) ?;
812
815
813
816
if self . downloads . pending . is_empty ( ) {
814
817
let delay = self . downloads . sleeping . time_to_next ( ) . unwrap ( ) ;
Original file line number Diff line number Diff line change @@ -3349,19 +3349,21 @@ fn sparse_blocking_count() {
3349
3349
3350
3350
Package :: new ( "bar" , "0.0.1" ) . publish ( ) ;
3351
3351
3352
+ // Ensure we have the expected number of `block_until_ready` calls.
3353
+ // The 1st (0 transfers pending), is the deliberate extra call in `ensure_loaded` for a source.
3354
+ // The 2nd (1 transfers pending), is the registry `config.json`.
3355
+ // the 3rd (1 transfers pending), is the package metadata for `bar`.
3356
+
3352
3357
p. cargo ( "check" )
3353
3358
. env ( "CARGO_LOG" , "network::HttpRegistry::block_until_ready=trace" )
3354
3359
. with_stderr_data ( str![ [ r#"
3355
3360
[..] TRACE network::HttpRegistry::block_until_ready: 0 transfers pending
3356
3361
[UPDATING] `dummy-registry` index
3357
3362
[..] TRACE network::HttpRegistry::block_until_ready: 1 transfers pending
3358
3363
[..] TRACE network::HttpRegistry::block_until_ready: 1 transfers pending
3359
- [..] TRACE network::HttpRegistry::block_until_ready: 1 transfers pending
3360
- [..] TRACE network::HttpRegistry::block_until_ready: 1 transfers pending
3361
3364
[WARNING] spurious network error (3 tries remaining): failed to get successful HTTP response from `[..]/index/3/b/bar` ([..]), got 500
3362
3365
body:
3363
3366
internal server error
3364
- [..] TRACE network::HttpRegistry::block_until_ready: 1 transfers pending
3365
3367
[LOCKING] 1 package to latest compatible version
3366
3368
[DOWNLOADING] crates ...
3367
3369
[DOWNLOADED] bar v0.0.1 (registry `dummy-registry`)
You can’t perform that action at this time.
0 commit comments