CacheMode::Never instead of filling in head block

This commit is contained in:
Bryan Stitt 2023-11-14 14:11:28 -08:00
parent 8ebce901d4
commit c2514fa528

@ -320,7 +320,7 @@ impl ValidatedRequest {
app: Option<&App>, app: Option<&App>,
authorization: Arc<Authorization>, authorization: Arc<Authorization>,
chain_id: u64, chain_id: u64,
mut head_block: Option<Web3ProxyBlock>, head_block: Option<Web3ProxyBlock>,
#[cfg(feature = "rdkafka")] kafka_debug_logger: Option<Arc<KafkaDebugLogger>>, #[cfg(feature = "rdkafka")] kafka_debug_logger: Option<Arc<KafkaDebugLogger>>,
max_wait: Option<Duration>, max_wait: Option<Duration>,
permit: Option<OwnedSemaphorePermit>, permit: Option<OwnedSemaphorePermit>,
@ -346,19 +346,16 @@ impl ValidatedRequest {
#[cfg(not(feature = "rdkafka"))] #[cfg(not(feature = "rdkafka"))]
let kafka_debug_logger = None; let kafka_debug_logger = None;
if head_block.is_none() {
if let Some(app) = app {
head_block = app.head_block_receiver().borrow().clone();
}
}
// now that kafka has logged the user's original params, we can calculate the cache key // now that kafka has logged the user's original params, we can calculate the cache key
// calculating the cache key might alter the params // calculating the CacheMode might alter the params
let cache_mode = if head_block.is_none() {
// TODO: modify CacheMode::new to wait for a future block if one is requested! be sure to update head_block too! CacheMode::Never
let cache_mode = match &mut request { } else {
RequestOrMethod::Request(x) => CacheMode::new(x, head_block.as_ref(), app).await?, // TODO: modify CacheMode::new to wait for a future block if one is requested! be sure to update head_block too!
_ => CacheMode::Never, match &mut request {
RequestOrMethod::Request(x) => CacheMode::new(x, head_block.as_ref(), app).await?,
_ => CacheMode::Never,
}
}; };
// TODO: what should we do if we want a really short max_wait? // TODO: what should we do if we want a really short max_wait?