@@ -29,7 +29,6 @@ const EXPERIMENTAL_WARNING: &str =
2929
3030const IMAGE_EXTENSIONS : & [ & str ] = & [ "png" , "jpg" , "jpeg" ] ;
3131const MAX_PIXELS_PER_IMAGE : u64 = 40_000_000 ;
32- const UPLOAD_BATCH_SIZE : usize = 100 ;
3332
3433pub fn make_command ( command : Command ) -> Command {
3534 command
@@ -399,39 +398,26 @@ fn upload_images(
399398 }
400399
401400 let total_count = uploads. len ( ) ;
402- let total_batches = total_count. div_ceil ( UPLOAD_BATCH_SIZE ) ;
403401
404- for ( batch_idx, chunk) in uploads. chunks ( UPLOAD_BATCH_SIZE ) . enumerate ( ) {
405- debug ! (
406- "Uploading batch {}/{total_batches} ({} images)" ,
407- batch_idx + 1 ,
408- chunk. len( )
402+ let mut many_builder = session. many ( ) ;
403+ for prepared in uploads {
404+ many_builder = many_builder. push (
405+ session
406+ . put_path ( prepared. path . clone ( ) )
407+ . key ( & prepared. key )
408+ . expiration_policy ( expiration) ,
409409 ) ;
410+ }
410411
411- let mut many_builder = session. many ( ) ;
412- for prepared in chunk {
413- many_builder = many_builder. push (
414- session
415- . put_path ( prepared. path . clone ( ) )
416- . key ( & prepared. key )
417- . expiration_policy ( expiration) ,
418- ) ;
419- }
420-
421- let result =
422- runtime. block_on ( async { many_builder. send ( ) . await . error_for_failures ( ) . await } ) ;
423- if let Err ( errors) = result {
424- let errors: Vec < _ > = errors. collect ( ) ;
425- eprintln ! ( "There were errors uploading images:" ) ;
426- for error in & errors {
427- eprintln ! ( " {}" , style( format!( "{error:#}" ) ) . red( ) ) ;
428- }
429- let error_count = errors. len ( ) ;
430- let batch_num = batch_idx + 1 ;
431- anyhow:: bail!(
432- "Failed to upload {error_count} images in batch {batch_num}/{total_batches}"
433- ) ;
412+ let result = runtime. block_on ( async { many_builder. send ( ) . await . error_for_failures ( ) . await } ) ;
413+ if let Err ( errors) = result {
414+ let errors: Vec < _ > = errors. collect ( ) ;
415+ eprintln ! ( "There were errors uploading images:" ) ;
416+ for error in & errors {
417+ eprintln ! ( " {}" , style( format!( "{error:#}" ) ) . red( ) ) ;
434418 }
419+ let error_count = errors. len ( ) ;
420+ anyhow:: bail!( "Failed to upload {error_count} images" ) ;
435421 }
436422
437423 println ! (
0 commit comments