diff --git a/execution/executor-benchmark/benches/executor_benchmark.rs b/execution/executor-benchmark/benches/executor_benchmark.rs index cada4225b38b6..7f1700f7dcd17 100644 --- a/execution/executor-benchmark/benches/executor_benchmark.rs +++ b/execution/executor-benchmark/benches/executor_benchmark.rs @@ -27,7 +27,7 @@ fn executor_benchmark(c: &mut Criterion) { let executor = Arc::new(executor); let mut generator = TransactionGenerator::new(genesis_key, NUM_ACCOUNTS); - let (commit_tx, _commit_rx) = std::sync::mpsc::channel(); + let (commit_tx, _commit_rx) = std::sync::mpsc::sync_channel(50 /* bound */); let mut executor = TransactionExecutor::new(executor, parent_block_id, 0, Some(commit_tx)); let txns = generator.gen_account_creations(SMALL_BLOCK_SIZE); diff --git a/execution/executor-benchmark/src/lib.rs b/execution/executor-benchmark/src/lib.rs index ad23939226c9b..3c50cb147d3c8 100644 --- a/execution/executor-benchmark/src/lib.rs +++ b/execution/executor-benchmark/src/lib.rs @@ -75,7 +75,7 @@ pub fn run_benchmark( let executor_2 = executor_1.clone(); let (block_sender, block_receiver) = mpsc::sync_channel(50 /* bound */); - let (commit_sender, commit_receiver) = mpsc::channel(); + let (commit_sender, commit_receiver) = mpsc::sync_channel(50 /* bound */); let mut generator = TransactionGenerator::new_with_metafile(genesis_key, block_sender, source_dir); diff --git a/execution/executor-benchmark/src/transaction_executor.rs b/execution/executor-benchmark/src/transaction_executor.rs index 8c9a0ca8f0ec9..1a0b06bff4fe2 100644 --- a/execution/executor-benchmark/src/transaction_executor.rs +++ b/execution/executor-benchmark/src/transaction_executor.rs @@ -17,7 +17,8 @@ pub struct TransactionExecutor { start_time: Instant, version: Version, // If commit_sender is `None`, we will commit all the execution result immediately in this struct. - commit_sender: Option>, + commit_sender: + Option>, } impl TransactionExecutor { @@ -26,7 +27,7 @@ impl TransactionExecutor { parent_block_id: HashValue, version: Version, commit_sender: Option< - mpsc::Sender<(HashValue, HashValue, Instant, Instant, Duration, usize)>, + mpsc::SyncSender<(HashValue, HashValue, Instant, Instant, Duration, usize)>, >, ) -> Self { Self {