From 9e89304eb774adf9493283a24e6fb5cbb166faf6 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Fri, 7 Jul 2023 21:58:00 -0700 Subject: [PATCH] try_send instead of send --- web3_proxy/src/frontend/authorization.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web3_proxy/src/frontend/authorization.rs b/web3_proxy/src/frontend/authorization.rs index 2c82c94f..85c93f91 100644 --- a/web3_proxy/src/frontend/authorization.rs +++ b/web3_proxy/src/frontend/authorization.rs @@ -525,18 +525,20 @@ impl RequestMetadata { pub fn try_send_stat(mut self) -> Web3ProxyResult> { if let Some(stat_sender) = self.stat_sender.take() { - trace!("sending stat! {:?}", self); + trace!(?self, "sending stat"); let stat: RpcQueryStats = self.try_into()?; let stat: AppStat = stat.into(); - if let Err(err) = stat_sender.send(stat) { - error!("failed sending stat {:?}: {:?}", err.0, err); + if let Err(err) = stat_sender.try_send(stat) { + error!(?err, "failed sending stat"); // TODO: return it? that seems like it might cause an infinite loop // TODO: but dropping stats is bad... hmm... i guess better to undercharge customers than overcharge }; + trace!("stat sent successfully"); + Ok(None) } else { Ok(Some(self))