diff --git a/graph-gateway/src/client_query.rs b/graph-gateway/src/client_query.rs index be016db6..23f76d50 100644 --- a/graph-gateway/src/client_query.rs +++ b/graph-gateway/src/client_query.rs @@ -143,10 +143,12 @@ pub async fn handle_query( .ok() .and_then(|(_, s)| s.as_ref()); let l2_subgraph_id = subgraph.and_then(|s| s.l2_id); - let deployments_migrated = matches!( - resolved_deployments.as_ref(), - Ok((deployments, _)) if deployments.iter().all(|d| d.transferred_to_l2), - ); + let deployments_migrated = ctx.l2_gateway.is_some() + && matches!( + resolved_deployments.as_ref(), + Ok((deployments, _)) if deployments.iter().all(|d| d.indexers.is_empty()), + ); + if l2_subgraph_id.is_some() || (subgraph.is_none() && deployments_migrated) { // We validate the configuration correctness at startup: L2 transfer redirection requires // the L2 gateway URL to be configured. diff --git a/graph-gateway/src/network_subgraph.rs b/graph-gateway/src/network_subgraph.rs index 886e96a6..b2f74c51 100644 --- a/graph-gateway/src/network_subgraph.rs +++ b/graph-gateway/src/network_subgraph.rs @@ -144,8 +144,8 @@ impl Client { first: $first where: {{ id_gt: $last - active: true entityVersion: 2 + {} }} ) {{ id @@ -173,6 +173,9 @@ impl Client { }} }} "#, + self.l2_transfer_support + .then_some("") + .unwrap_or("active: true"), self.l2_transfer_support.then_some("idOnL2").unwrap_or(""), self.l2_transfer_support .then_some("startedTransferToL2At")