From bbdff1d916e63ef2bca0c6dd4627677d3ad0278f Mon Sep 17 00:00:00 2001 From: yenicelik Date: Sun, 25 Jun 2023 21:02:07 -0400 Subject: [PATCH] some code got lost in all the commits, deploying again --- web3_proxy/src/stats/mod.rs | 8 +++++--- web3_proxy/src/stats/stat_buffer.rs | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/web3_proxy/src/stats/mod.rs b/web3_proxy/src/stats/mod.rs index fe2a1c52..ef84ad87 100644 --- a/web3_proxy/src/stats/mod.rs +++ b/web3_proxy/src/stats/mod.rs @@ -31,7 +31,7 @@ use std::num::NonZeroU64; use std::str::FromStr; use std::sync::atomic::{self, Ordering}; use std::sync::Arc; -use tracing::trace; +use tracing::{trace, warn}; pub use stat_buffer::{SpawnedStatBuffer, StatBuffer}; @@ -199,6 +199,9 @@ impl BufferedRpcQueryStats { self.sum_response_bytes += stat.response_bytes; self.sum_response_millis += stat.response_millis; self.sum_credits_used += stat.compute_unit_cost; + + let latest_balance = stat.authorization.checks.latest_balance.read(); + self.latest_balance = latest_balance.clone(); } async fn _save_db_stats( @@ -723,8 +726,7 @@ impl BufferedRpcQueryStats { builder = builder.tag("method", key.method); // Read the latest balance ... - let remaining = self.latest_balance.read().remaining(); - + let remaining = self.latest_balance.remaining(); trace!("Remaining balance for influx is {:?}", remaining); builder = builder diff --git a/web3_proxy/src/stats/stat_buffer.rs b/web3_proxy/src/stats/stat_buffer.rs index 4684fe57..7db8554c 100644 --- a/web3_proxy/src/stats/stat_buffer.rs +++ b/web3_proxy/src/stats/stat_buffer.rs @@ -29,7 +29,7 @@ pub struct BufferedRpcQueryStats { pub sum_credits_used: Decimal, pub sum_cu_used: Decimal, /// The user's balance at this point in time. Multiple queries might be modifying it at once. - pub latest_balance: Arc>, + pub latest_balance: Balance, } #[derive(From)]