From a8d2f3fe62ed0f5bea7b87ef484544aceb5d9b99 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Thu, 6 Jul 2023 14:58:13 -0700 Subject: [PATCH] include the error in the warning --- web3_proxy/src/stats/stat_buffer.rs | 31 ++++++++++++++++------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/web3_proxy/src/stats/stat_buffer.rs b/web3_proxy/src/stats/stat_buffer.rs index a5976576..cd3314d3 100644 --- a/web3_proxy/src/stats/stat_buffer.rs +++ b/web3_proxy/src/stats/stat_buffer.rs @@ -160,24 +160,27 @@ impl StatBuffer { } } x = flush_receiver.recv_async() => { - if let Ok(x) = x { - trace!("flush"); + match x { + Ok(x) => { + trace!("flush"); - let tsdb_count = self.save_tsdb_stats().await; - if tsdb_count > 0 { - trace!("Flushed {} stats to the tsdb", tsdb_count); - } + let tsdb_count = self.save_tsdb_stats().await; + if tsdb_count > 0 { + trace!("Flushed {} stats to the tsdb", tsdb_count); + } - let relational_count = self.save_relational_stats().await; - if relational_count > 0 { - trace!("Flushed {} stats to the relational db", relational_count); - } + let relational_count = self.save_relational_stats().await; + if relational_count > 0 { + trace!("Flushed {} stats to the relational db", relational_count); + } - if let Err(err) = x.send((tsdb_count, relational_count)) { - warn!(%tsdb_count, %relational_count, ?err, "unable to notify about flushed stats"); + if let Err(err) = x.send((tsdb_count, relational_count)) { + warn!(%tsdb_count, %relational_count, ?err, "unable to notify about flushed stats"); + } + } + Err(err) => { + warn!(?err, "unable to flush stat buffer!"); } - } else { - warn!("unable to flush stat buffer!"); } } x = shutdown_receiver.recv() => {