Skip to content

Commit

Permalink
fix: track transferred subgraphs despite inactive status
Browse files Browse the repository at this point in the history
  • Loading branch information
Theodus committed Aug 14, 2023
1 parent da71648 commit 86077bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 6 additions & 4 deletions graph-gateway/src/client_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion graph-gateway/src/network_subgraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ impl Client {
first: $first
where: {{
id_gt: $last
active: true
entityVersion: 2
{}
}}
) {{
id
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 86077bb

Please sign in to comment.