File tree Expand file tree Collapse file tree 4 files changed +16
-11
lines changed Expand file tree Collapse file tree 4 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -962,14 +962,14 @@ fn try_update_from_dist_(
962
962
963
963
fetched. clone_from ( & m. date ) ;
964
964
965
- return match manifestation. update (
965
+ return match utils :: run_future ( manifestation. update (
966
966
& m,
967
967
changes,
968
968
force_update,
969
969
& download,
970
970
& toolchain. manifest_name ( ) ,
971
971
true ,
972
- ) {
972
+ ) ) {
973
973
Ok ( status) => match status {
974
974
UpdateStatus :: Unchanged => Ok ( None ) ,
975
975
UpdateStatus :: Changed => Ok ( Some ( hash) ) ,
Original file line number Diff line number Diff line change @@ -98,7 +98,10 @@ impl Manifestation {
98
98
/// distribution manifest to "rustlib/rustup-dist.toml" and a
99
99
/// configuration containing the component name-target pairs to
100
100
/// "rustlib/rustup-config.toml".
101
- pub fn update (
101
+ ///
102
+ /// It is *not* safe to run two updates concurrently. See
103
+ /// https://github.com/rust-lang/rustup/issues/988 for the details.
104
+ pub async fn update (
102
105
& self ,
103
106
new_manifest : & Manifest ,
104
107
changes : Changes ,
@@ -172,7 +175,7 @@ impl Manifestation {
172
175
173
176
let url_url = utils:: parse_url ( & url) ?;
174
177
175
- let downloaded_file = utils :: run_future ( RetryIf :: spawn (
178
+ let downloaded_file = RetryIf :: spawn (
176
179
FixedInterval :: from_millis ( 0 ) . take ( max_retries) ,
177
180
|| download_cfg. download ( & url_url, & hash) ,
178
181
|e : & anyhow:: Error | {
@@ -186,7 +189,8 @@ impl Manifestation {
186
189
_ => false ,
187
190
}
188
191
} ,
189
- ) )
192
+ )
193
+ . await
190
194
. with_context ( || RustupError :: ComponentDownloadFailed ( component. name ( new_manifest) ) ) ?;
191
195
192
196
things_downloaded. push ( hash) ;
Original file line number Diff line number Diff line change @@ -466,14 +466,14 @@ fn update_from_dist(
466
466
remove_components : remove. to_owned ( ) ,
467
467
} ;
468
468
469
- manifestation. update (
469
+ utils :: run_future ( manifestation. update (
470
470
& manifest,
471
471
changes,
472
472
force,
473
473
download_cfg,
474
474
& toolchain. manifest_name ( ) ,
475
475
true ,
476
- )
476
+ ) )
477
477
}
478
478
479
479
fn make_manifest_url ( dist_server : & Url , toolchain : & ToolchainDesc ) -> Result < Url > {
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ use crate::{
16
16
} ,
17
17
install:: { InstallMethod , UpdateStatus } ,
18
18
notifications:: Notification ,
19
+ utils:: utils,
19
20
RustupError ,
20
21
} ;
21
22
@@ -110,14 +111,14 @@ impl<'a> DistributableToolchain<'a> {
110
111
& |n : crate :: dist:: Notification < ' _ > | ( self . cfg . notify_handler ) ( n. into ( ) ) ;
111
112
let download_cfg = self . cfg . download_cfg ( & notify_handler) ;
112
113
113
- manifestation. update (
114
+ utils :: run_future ( manifestation. update (
114
115
& manifest,
115
116
changes,
116
117
false ,
117
118
& download_cfg,
118
119
& self . desc . manifest_name ( ) ,
119
120
false ,
120
- ) ?;
121
+ ) ) ?;
121
122
122
123
Ok ( ( ) )
123
124
}
@@ -508,14 +509,14 @@ impl<'a> DistributableToolchain<'a> {
508
509
& |n : crate :: dist:: Notification < ' _ > | ( self . cfg . notify_handler ) ( n. into ( ) ) ;
509
510
let download_cfg = self . cfg . download_cfg ( & notify_handler) ;
510
511
511
- manifestation. update (
512
+ utils :: run_future ( manifestation. update (
512
513
& manifest,
513
514
changes,
514
515
false ,
515
516
& download_cfg,
516
517
& self . desc . manifest_name ( ) ,
517
518
false ,
518
- ) ?;
519
+ ) ) ?;
519
520
520
521
Ok ( ( ) )
521
522
}
You can’t perform that action at this time.
0 commit comments