Skip to content

Commit

Permalink
Changed Rayon Scope
Browse files Browse the repository at this point in the history
  • Loading branch information
root authored and root committed Oct 31, 2023
1 parent c6d19c5 commit 2d72084
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions crates/primitives/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -884,22 +884,22 @@ impl TransactionSigned {

let mut channels = Vec::new();

for chunk in vectors {
let (recovered_senders_tx, recovered_senders_rx) = mpsc::unbounded_channel();
channels.push(recovered_senders_rx);

// Spawn the sender recovery task onto the global rayon pool
// This task will send the results through the channel after it recovered the
// senders.
rayon::scope(|s| {
rayon::scope(|s| {
for chunk in vectors {
let (recovered_senders_tx, recovered_senders_rx) = mpsc::unbounded_channel();
channels.push(recovered_senders_rx);

// Spawn the sender recovery task onto the global rayon pool
// This task will send the results through the channel after it recovered the
// senders.
s.spawn(move |_| {
for tx in chunk {
let recovery_result = tx.recover_signer();
let _ = recovered_senders_tx.send(recovery_result);
}
});
})
}
}
});

for mut channel in channels {
while let Some(recovered) = channel.blocking_recv() {
Expand Down

0 comments on commit 2d72084

Please sign in to comment.