File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
mithril-client/src/cardano_database_client Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -341,17 +341,19 @@ impl InternalArtifactDownloader {
341
341
) -> MithrilResult < ( ) > {
342
342
let mut join_set: JoinSet < MithrilResult < ( ) > > = JoinSet :: new ( ) ;
343
343
344
- while !tasks. is_empty ( ) {
345
- let tasks_chunk = tasks. pop_up_to_n ( max_parallel_downloads) ;
344
+ let initial_tasks_chunk = tasks. pop_up_to_n ( max_parallel_downloads) ;
345
+ for task in initial_tasks_chunk {
346
+ join_set. spawn ( self . spawn_download_future ( task) ) ;
347
+ }
346
348
347
- for task in tasks_chunk {
348
- join_set. spawn ( self . spawn_download_future ( task) ) ;
349
+ while let Some ( result) = join_set. join_next ( ) . await {
350
+ if let Err ( error) = result? {
351
+ join_set. abort_all ( ) ;
352
+ anyhow:: bail!( error) ;
349
353
}
350
- while let Some ( result) = join_set. join_next ( ) . await {
351
- if let Err ( error) = result? {
352
- join_set. abort_all ( ) ;
353
- anyhow:: bail!( error) ;
354
- }
354
+
355
+ if let Some ( task) = tasks. pop_front ( ) {
356
+ join_set. spawn ( self . spawn_download_future ( task) ) ;
355
357
}
356
358
}
357
359
You can’t perform that action at this time.
0 commit comments