diff --git a/web3-proxy/src/app.rs b/web3-proxy/src/app.rs index 91646ef2..d6344d89 100644 --- a/web3-proxy/src/app.rs +++ b/web3-proxy/src/app.rs @@ -48,12 +48,14 @@ const RESPONSE_CACHE_CAP: usize = 1024; // block hash, method, params type CacheKey = (H256, String, Option); +// TODO: make something more advanced that keeps track of cache size in bytes type ResponseLrcCache = RwLock>; type ActiveRequestsMap = DashMap>; pub type AnyhowJoinHandle = JoinHandle>; +/// flatten a JoinError into an anyhow error pub async fn flatten_handle(handle: AnyhowJoinHandle) -> anyhow::Result { match handle.await { Ok(Ok(result)) => Ok(result), @@ -62,6 +64,7 @@ pub async fn flatten_handle(handle: AnyhowJoinHandle) -> anyhow::Result } } +/// return the first error or okay if everything worked pub async fn flatten_handles( mut handles: FuturesUnordered>, ) -> anyhow::Result<()> { @@ -69,7 +72,7 @@ pub async fn flatten_handles( match x { Err(e) => return Err(e.into()), Ok(Err(e)) => return Err(e), - Ok(Ok(_)) => {} + Ok(Ok(_)) => continue, } } diff --git a/web3-proxy/src/connections.rs b/web3-proxy/src/connections.rs index 1dc87fc4..76282c16 100644 --- a/web3-proxy/src/connections.rs +++ b/web3-proxy/src/connections.rs @@ -840,6 +840,7 @@ impl Web3Connections { // TODO: return a 502? if it does? // return Err(anyhow::anyhow!("no available rpcs!")); // TODO: sleep how long? + // TODO: subscribe to something in SyncedConnections instead sleep(Duration::from_millis(200)).await; continue;