Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

agent: defend against graph-node bug #5550 (null paused) #978

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -149,18 +149,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 @@ -174,7 +203,7 @@ export class GraphNode {

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

Expand Down
Loading