Skip to content

Commit c58b06a

Browse files
committed
first map, then send
1 parent 34ccc7a commit c58b06a

File tree

1 file changed

+5
-6
lines changed
  • crates/engine/tree/src/tree/payload_processor

1 file changed

+5
-6
lines changed

crates/engine/tree/src/tree/payload_processor/mod.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,17 +324,16 @@ where
324324
let (prewarm_tx, prewarm_rx) = mpsc::channel();
325325
let (execute_tx, execute_rx) = mpsc::channel();
326326
self.executor.spawn_blocking(move || {
327-
transactions.par_bridge().for_each_with(
328-
(prewarm_tx, execute_tx),
329-
|(prewarm_tx, execute_tx), tx| {
330-
let tx = tx.map(|tx| WithTxEnv { tx_env: tx.to_tx_env(), tx: Arc::new(tx) });
327+
transactions
328+
.par_bridge()
329+
.map(|tx| tx.map(|tx| WithTxEnv { tx_env: tx.to_tx_env(), tx: Arc::new(tx) }))
330+
.for_each_with((prewarm_tx, execute_tx), |(prewarm_tx, execute_tx), tx| {
331331
// only send Ok(_) variants to prewarming task
332332
if let Ok(tx) = &tx {
333333
let _ = prewarm_tx.send(tx.clone());
334334
}
335335
let _ = execute_tx.send(tx);
336-
},
337-
);
336+
});
338337
});
339338

340339
(prewarm_rx, execute_rx, transaction_count_hint)

0 commit comments

Comments
 (0)