Skip to content

Commit

Permalink
fix(agent): defend against graph-node bug #5550 (null paused)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwerner committed Aug 8, 2024
1 parent 3efefd9 commit b2188e6
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions packages/indexer-common/src/graph-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,47 @@ export class GraphNode {
): Promise<SubgraphDeploymentAssignment[]> {
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
}
}
`)
.toPromise()

if (nodeOnlyResult.error) {
throw nodeOnlyResult.error
}

const withAssignments: string[] = nodeOnlyResult.data.indexingStatuses
.filter((result: QueryResult) => {
return result.node !== undefined
})
.map((result: QueryResult) => {
return result.subgraphDeployment
})

const result = await this.status
.query(
gql`
{
indexingStatuses($subgraphs) {
subgraphDeployment: subgraph
node
paused
}
}
`,
{ subgraphs: withAssignments },
)
.toPromise()

if (result.error) {
throw result.error
}
Expand All @@ -178,7 +207,7 @@ export class GraphNode {

type QueryResult = {
subgraphDeployment: string
node: string
node: string | undefined
paused: boolean | undefined
}

Expand Down

0 comments on commit b2188e6

Please sign in to comment.