@@ -271,10 +271,10 @@ pub struct SingleDiskPlotOptions<RC> {
271271 pub reward_address : PublicKey ,
272272 /// Optional DSN Node.
273273 pub dsn_node : Node ,
274- /// Defines size for the pieces batch of the piece receiving process.
275- pub piece_receiver_batch_size : usize ,
276- /// Defines size for the pieces batch of the piece publishing process.
277- pub piece_publisher_batch_size : usize ,
274+ /// Semaphore to limit concurrency of piece receiving process.
275+ pub piece_receiver_semaphore : Arc < tokio :: sync :: Semaphore > ,
276+ /// Semaphore to limit concurrency of piece publishing process.
277+ pub piece_publisher_semaphore : Arc < tokio :: sync :: Semaphore > ,
278278}
279279
280280/// Errors happening when trying to create/open single disk plot
@@ -468,8 +468,8 @@ impl SingleDiskPlot {
468468 rpc_client,
469469 reward_address,
470470 dsn_node,
471- piece_receiver_batch_size ,
472- piece_publisher_batch_size ,
471+ piece_publisher_semaphore ,
472+ piece_receiver_semaphore ,
473473 } = options;
474474
475475 // TODO: Account for plot overhead
@@ -648,7 +648,7 @@ impl SingleDiskPlot {
648648 let rpc_client = rpc_client. clone ( ) ;
649649 let error_sender = Arc :: clone ( & error_sender) ;
650650 let piece_publisher =
651- PieceSectorPublisher :: new ( dsn_node. clone ( ) , shutting_down. clone ( ) ) ;
651+ PieceSectorPublisher :: new ( dsn_node. clone ( ) , shutting_down. clone ( ) , piece_publisher_semaphore ) ;
652652
653653 move || {
654654 let _tokio_handle_guard = handle. enter ( ) ;
@@ -709,7 +709,7 @@ impl SingleDiskPlot {
709709 & sector_codec,
710710 sector,
711711 sector_metadata,
712- piece_receiver_batch_size ,
712+ & piece_receiver_semaphore ,
713713 ) ) {
714714 Ok ( plotted_sector) => {
715715 debug ! ( %sector_index, "Sector plotted" ) ;
@@ -738,7 +738,7 @@ impl SingleDiskPlot {
738738
739739 async move {
740740 if let Err ( error) = piece_publisher
741- . publish_pieces ( plotted_sector. piece_indexes , piece_publisher_batch_size )
741+ . publish_pieces ( plotted_sector. piece_indexes )
742742 . await
743743 {
744744 warn ! ( %sector_index, %error, "Failed to publish pieces to DSN" ) ;
0 commit comments