@@ -1568,8 +1568,10 @@ impl Batcher {
15681568 let batch_merkle_root_hex = hex:: encode ( batch_merkle_root) ;
15691569 info ! ( "Batch merkle root: 0x{}" , batch_merkle_root_hex) ;
15701570 let file_name = batch_merkle_root_hex. clone ( ) + ".json" ;
1571-
1572- let batch_data_pointer = self . upload_batch_to_multiple_s3 ( batch_bytes, & file_name) . await ?;
1571+
1572+ let batch_data_pointer = self
1573+ . upload_batch_to_multiple_s3 ( batch_bytes, & file_name)
1574+ . await ?;
15731575 if let Err ( e) = self
15741576 . telemetry
15751577 . task_uploaded_to_s3 ( & batch_merkle_root_hex)
@@ -1892,34 +1894,59 @@ impl Batcher {
18921894 ) -> Result < String , BatcherError > {
18931895 // Upload to both S3 buckets and collect successful URLs
18941896 let mut successful_urls = Vec :: new ( ) ;
1895-
1897+
18961898 // Try primary S3 upload
1897- if let Ok ( _) = self . upload_batch_to_s3 ( & self . s3_client , batch_bytes, file_name, & self . s3_bucket_name ) . await {
1899+ if self
1900+ . upload_batch_to_s3 (
1901+ & self . s3_client ,
1902+ batch_bytes,
1903+ file_name,
1904+ & self . s3_bucket_name ,
1905+ )
1906+ . await
1907+ . is_ok ( )
1908+ {
18981909 let primary_url = format ! ( "{}/{}" , self . download_endpoint, file_name) ;
18991910 successful_urls. push ( primary_url. clone ( ) ) ;
19001911 info ! ( "Successfully uploaded batch to primary S3: {}" , primary_url) ;
19011912 } else {
19021913 warn ! ( "Failed to upload batch to primary S3" ) ;
19031914 }
1904-
1915+
19051916 // Try secondary S3 upload
1906- if let Ok ( _) = self . upload_batch_to_s3 ( & self . s3_client_secondary , batch_bytes, file_name, & self . s3_bucket_name_secondary ) . await {
1917+ if self
1918+ . upload_batch_to_s3 (
1919+ & self . s3_client_secondary ,
1920+ batch_bytes,
1921+ file_name,
1922+ & self . s3_bucket_name_secondary ,
1923+ )
1924+ . await
1925+ . is_ok ( )
1926+ {
19071927 let secondary_url = format ! ( "{}/{}" , self . download_endpoint_secondary, file_name) ;
19081928 successful_urls. push ( secondary_url. clone ( ) ) ;
1909- info ! ( "Successfully uploaded batch to secondary S3: {}" , secondary_url) ;
1929+ info ! (
1930+ "Successfully uploaded batch to secondary S3: {}" ,
1931+ secondary_url
1932+ ) ;
19101933 } else {
19111934 warn ! ( "Failed to upload batch to secondary S3" ) ;
19121935 }
1913-
1936+
19141937 // Update metrics with number of available data services
1915- self . metrics . available_data_services . set ( successful_urls. len ( ) as i64 ) ;
1916-
1938+ self . metrics
1939+ . available_data_services
1940+ . set ( successful_urls. len ( ) as i64 ) ;
1941+
19171942 // If no uploads succeeded, return error
19181943 if successful_urls. is_empty ( ) {
19191944 error ! ( "Failed to upload batch to both S3 buckets" ) ;
1920- return Err ( BatcherError :: BatchUploadError ( "Failed to upload to any S3 bucket" . to_string ( ) ) ) ;
1945+ return Err ( BatcherError :: BatchUploadError (
1946+ "Failed to upload to any S3 bucket" . to_string ( ) ,
1947+ ) ) ;
19211948 }
1922-
1949+
19231950 Ok ( successful_urls. join ( "," ) )
19241951 }
19251952
0 commit comments