Skip to content

Commit

Permalink
Revert "common: remove paused workaround (perf)"
Browse files Browse the repository at this point in the history
This reverts commit f2cd527.
  • Loading branch information
dwerner committed Oct 30, 2024
1 parent 667db49 commit 2dc28ff
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions packages/indexer-common/src/graph-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,50 @@ 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
}
}
`,
undefined,
)
.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
}
Expand Down

0 comments on commit 2dc28ff

Please sign in to comment.