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 Mar 8, 2024
1 parent ee224d8 commit 736ea10
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 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)),
pause.map(deployment => async () => this.graphNode.pause(deployment)),
)

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

async remove(deployment: SubgraphDeploymentID): Promise<void> {
async pause(deployment: SubgraphDeploymentID): Promise<void> {
try {
this.logger.info(`Remove subgraph deployment`, {
this.logger.info(`Pause subgraph deployment`, {
deployment: deployment.display,
})
const response = await this.admin.request('subgraph_reassign', {
node_id: 'removed',
ipfs_hash: deployment.ipfsHash,
const response = await this.admin.request('subgraph_pause', {
deployment: deployment.ipfsHash,
})
if (response.error) {
throw response.error
}
this.logger.info(`Successfully removed subgraph deployment`, {
this.logger.info(`Successfully paused subgraph deployment`, {
deployment: deployment.display,
})
} catch (error) {
Expand Down

0 comments on commit 736ea10

Please sign in to comment.