From 9e28b7d91138691b2f01b8ef27bc0a376d7d147d Mon Sep 17 00:00:00 2001 From: renancloudwalk <53792026+renancloudwalk@users.noreply.github.com> Date: Thu, 25 Apr 2024 09:43:59 -0300 Subject: [PATCH] fix: backup engine check (#693) --- src/eth/storage/rocks/rocks_permanent.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/eth/storage/rocks/rocks_permanent.rs b/src/eth/storage/rocks/rocks_permanent.rs index 4dfd94ef2..7d1f51866 100644 --- a/src/eth/storage/rocks/rocks_permanent.rs +++ b/src/eth/storage/rocks/rocks_permanent.rs @@ -33,7 +33,7 @@ use crate::eth::storage::PermanentStorage; use crate::eth::storage::StorageError; /// used for multiple purposes, such as TPS counting and backup management -const TRANSACTION_LOOP_THRESHOLD: usize = 420_000; +const TRANSACTION_LOOP_THRESHOLD: usize = 120_000; static TRANSACTIONS_COUNT: AtomicUsize = AtomicUsize::new(0); @@ -220,12 +220,13 @@ impl PermanentStorage for RocksPermanentStorage { ); let previous_count = TRANSACTIONS_COUNT.load(Ordering::Relaxed); - let current_count = TRANSACTIONS_COUNT.fetch_add(block.transactions.len(), Ordering::Relaxed); + let _ = TRANSACTIONS_COUNT.fetch_add(block.transactions.len(), Ordering::Relaxed); + let current_count = TRANSACTIONS_COUNT.load(Ordering::Relaxed); // for every multiple of TRANSACTION_LOOP_THRESHOLD transactions, send a Backup signal if previous_count % TRANSACTION_LOOP_THRESHOLD > current_count % TRANSACTION_LOOP_THRESHOLD { - let x = Arc::clone(&self.state.backup_trigger); - x.send(()).await.unwrap(); + let backup_channel = Arc::clone(&self.state.backup_trigger); + backup_channel.send(()).await.unwrap(); TRANSACTIONS_COUNT.store(0, Ordering::Relaxed); }