graphql: Fix check against GRAPH_CACHED_SUBGRAPH_IDS
@@ -238,8 +238,15 @@ pub(crate) async fn execute_root_selection_set<R: Resolver>(
// and once for insert.
let mut key: Option<QueryHash> = None;
- if let CachedSubgraphIds::Only(ref cached_subgraph_ids) = ENV_VARS.cached_subgraph_ids {
- if R::CACHEABLE && cached_subgraph_ids.contains(ctx.query.schema.id()) {
+ let should_check_cache = R::CACHEABLE
+ && match ENV_VARS.cached_subgraph_ids {
+ CachedSubgraphIds::All => true,
+ CachedSubgraphIds::Only(ref subgraph_ids) => {
+ subgraph_ids.contains(ctx.query.schema.id())
+ }
+ };
+
+ if should_check_cache {
if let (Some(block_ptr), Some(network)) = (block_ptr.as_ref(), &ctx.query.network) {
// JSONB and metadata queries use `BLOCK_NUMBER_MAX`. Ignore this case for two reasons:
// - Metadata queries are not cacheable.
@@ -270,7 +277,6 @@ pub(crate) async fn execute_root_selection_set<R: Resolver>(
}
}
}
- }
let execute_ctx = ctx.cheap_clone();
let execute_selection_set = selection_set.cheap_clone();
