diff --git a/packages/indexer-common/src/graph-node.ts b/packages/indexer-common/src/graph-node.ts index ca0995b12..9e47d6616 100644 --- a/packages/indexer-common/src/graph-node.ts +++ b/packages/indexer-common/src/graph-node.ts @@ -153,14 +153,16 @@ export class GraphNode { ): Promise { try { this.logger.debug('Fetch subgraph deployment assignments') - const result = await this.status + + // FIXME: remove this initial check for just node when graph-node releases + // https://github.com/graphprotocol/graph-node/pull/5551 + const nodeOnlyResult = await this.status .query( gql` { indexingStatuses { subgraphDeployment: subgraph node - paused } } `, @@ -168,6 +170,33 @@ export class GraphNode { ) .toPromise() + if (nodeOnlyResult.error) { + throw nodeOnlyResult.error + } + + const withAssignments: string[] = nodeOnlyResult.data.indexingStatuses + .filter((result: QueryResult) => { + return result.node !== null && result.node !== undefined + }) + .map((result: QueryResult) => { + return result.subgraphDeployment + }) + + const result = await this.status + .query( + gql` + query indexingStatuses($subgraphs: [String!]!) { + indexingStatuses(subgraphs: $subgraphs) { + subgraphDeployment: subgraph + node + paused + } + } + `, + { subgraphs: withAssignments }, + ) + .toPromise() + if (result.error) { throw result.error }