From fda768ec01826fcb8b8f21878edd2c7ac7bc74bb Mon Sep 17 00:00:00 2001 From: Theo Butler Date: Mon, 14 Aug 2023 12:29:07 -0400 Subject: [PATCH] fix: track transferred subgraphs despite inactive status --- graph-gateway/src/client_query.rs | 2 +- graph-gateway/src/network_subgraph.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/graph-gateway/src/client_query.rs b/graph-gateway/src/client_query.rs index fadaaf443..6a3b97e37 100644 --- a/graph-gateway/src/client_query.rs +++ b/graph-gateway/src/client_query.rs @@ -145,7 +145,7 @@ pub async fn handle_query( 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), + 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 diff --git a/graph-gateway/src/network_subgraph.rs b/graph-gateway/src/network_subgraph.rs index 886e96a65..b2f74c512 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")