Skip to content

Commit

Permalink
agent,common: Use new subgraph pausing mechanism
Browse files Browse the repository at this point in the history
- Use subgraph_pause JSON-RPC method instead of subgraph_reassign, which
explicitly pauses subgraph instead of virtually pausing it by moving
it to a non-existent index node
  • Loading branch information
fordN committed Jul 8, 2024
1 parent 9a23b68 commit 9ded337
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
2 changes: 1 addition & 1 deletion packages/indexer-agent/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ export class Agent {

// Stop indexing deployments that are no longer worth indexing
await queue.addAll(
remove.map(deployment => async () => this.graphNode.remove(deployment)),
remove.map(deployment => async () => this.graphNode.pause(deployment)),
)

await queue.onIdle()
Expand Down
24 changes: 0 additions & 24 deletions packages/indexer-common/src/graph-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,30 +331,6 @@ export class GraphNode {
}
}

async remove(deployment: SubgraphDeploymentID): Promise<void> {
try {
this.logger.info(`Remove subgraph deployment`, {
deployment: deployment.display,
})
const response = await this.admin.request('subgraph_reassign', {
node_id: 'removed',
ipfs_hash: deployment.ipfsHash,
})
if (response.error) {
throw response.error
}
this.logger.info(`Successfully removed subgraph deployment`, {
deployment: deployment.display,
})
} catch (error) {
const errorCode = IndexerErrorCode.IE027
this.logger.error(INDEXER_ERROR_MESSAGES[errorCode], {
deployment: deployment.display,
error: indexerError(errorCode, error),
})
}
}

async pause(deployment: SubgraphDeploymentID): Promise<void> {
try {
this.logger.info(`Pause subgraph deployment`, {
Expand Down

0 comments on commit 9ded337

Please sign in to comment.