fake swap

This commit is contained in:
Aniket Prajapati 2023-01-10 12:57:48 +05:30
parent bea2403e2a
commit 333eeab7fd
No known key found for this signature in database
GPG Key ID: D4346D8C9C5398F2
1 changed files with 2 additions and 4 deletions

View File

@ -37,13 +37,11 @@ impl TxSender {
}
/// retry enqued_tx(s)
pub async fn retry_txs(&self, tx_batch_size: usize) {
pub async fn forward_txs(&self, tx_batch_size: usize) {
let mut enqueued_txs = Vec::new();
std::mem::swap(&mut enqueued_txs, &mut self.enqueued_txs.write().unwrap());
let enqueued_txs = self.enqueued_txs.read().unwrap().clone();
let len = enqueued_txs.len();
if len == 0 {
@ -91,7 +89,7 @@ impl TxSender {
loop {
interval.tick().await;
self.retry_txs(tx_batch_size).await;
self.forward_txs(tx_batch_size).await;
}
// to give the correct type to JoinHandle