From 37e3d0be2bb26e10098fecb6a654b08fe16f9605 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Fri, 14 Jul 2023 01:19:09 -0700 Subject: [PATCH] you cant do a runtime in a drop like this apparently --- web3_proxy/src/app/mod.rs | 20 -------------------- web3_proxy/src/errors.rs | 1 + 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/web3_proxy/src/app/mod.rs b/web3_proxy/src/app/mod.rs index f6f5bfc9..c3eadbbb 100644 --- a/web3_proxy/src/app/mod.rs +++ b/web3_proxy/src/app/mod.rs @@ -166,26 +166,6 @@ pub struct Web3ProxyAppSpawn { pub ranked_rpcs: watch::Receiver>>, } -impl Drop for Web3ProxyApp { - fn drop(&mut self) { - if let Ok(db_conn) = self.db_conn().cloned() { - /* - From the sqlx docs: - - We recommend calling .close().await to gracefully close the pool and its connections when you are done using it. - This will also wake any tasks that are waiting on an .acquire() call, - so for long-lived applications it’s a good idea to call .close() during shutdown. - */ - - let rt = Runtime::new().unwrap(); - - if let Err(err) = rt.block_on(db_conn.close()) { - error!(?err, "Unable to close db!"); - }; - } - } -} - impl Web3ProxyApp { /// The main entrypoint. pub async fn spawn( diff --git a/web3_proxy/src/errors.rs b/web3_proxy/src/errors.rs index b9eb81d9..e359f7e8 100644 --- a/web3_proxy/src/errors.rs +++ b/web3_proxy/src/errors.rs @@ -615,6 +615,7 @@ impl Web3ProxyError { ) } Self::NoDatabase => { + // TODO: this needs more context error!("no database configured"); ( StatusCode::INTERNAL_SERVER_ERROR,