From e0d1d4b51747ca46f6aa17c1ba8c3d279ee4b5ba Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Wed, 8 Nov 2023 11:45:36 -0800 Subject: [PATCH] premium timeout 295. public 60 --- web3_proxy/src/jsonrpc/request_builder.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/web3_proxy/src/jsonrpc/request_builder.rs b/web3_proxy/src/jsonrpc/request_builder.rs index af45509f..5b473339 100644 --- a/web3_proxy/src/jsonrpc/request_builder.rs +++ b/web3_proxy/src/jsonrpc/request_builder.rs @@ -356,8 +356,17 @@ impl ValidatedRequest { _ => CacheMode::Never, }; + // TODO: what should we do if we want a really short max_wait? let connect_timeout = Duration::from_secs(10); - let expire_timeout = max_wait.unwrap_or_else(|| Duration::from_secs(295)); + + let expire_timeout = if let Some(max_wait) = max_wait { + max_wait + } else if authorization.active_premium().await { + Duration::from_secs(295) + } else { + Duration::from_secs(60) + } + .max(connect_timeout); let x = Self { archive_request: false.into(),