From 68953c1b121348c501a2b746989259920a2cbca6 Mon Sep 17 00:00:00 2001 From: Ford Date: Fri, 23 Aug 2024 12:06:00 -0700 Subject: [PATCH] agent: Make migration 14 more specific and robust - Only effect subgraphs assigned to node = 'removed' --- .../migrations/14-use-new-deployment-pause-mechanism.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/indexer-agent/src/db/migrations/14-use-new-deployment-pause-mechanism.ts b/packages/indexer-agent/src/db/migrations/14-use-new-deployment-pause-mechanism.ts index 92a01d66b..e4886f645 100644 --- a/packages/indexer-agent/src/db/migrations/14-use-new-deployment-pause-mechanism.ts +++ b/packages/indexer-agent/src/db/migrations/14-use-new-deployment-pause-mechanism.ts @@ -2,6 +2,7 @@ import { Logger } from '@graphprotocol/common-ts' import { GraphNode, specification, + SubgraphDeploymentAssignment, SubgraphStatus, } from '@graphprotocol/indexer-common' import { QueryInterface } from 'sequelize' @@ -38,9 +39,15 @@ export async function up({ context }: Context): Promise { return nodeA.deployments.length - nodeB.deployments.length })[0]?.id || 'default' - const virtuallyPausedDeploymentAssignments = + const pausedDeploymentAssignments = await graphNode.subgraphDeploymentsAssignments(SubgraphStatus.PAUSED) + const virtuallyPausedDeploymentAssignments = + pausedDeploymentAssignments.filter( + (assignment: SubgraphDeploymentAssignment) => + assignment.node === 'removed', + ) + logger.info( 'Reassigning paused subgraphs to valid node_id (targetNode), then pausing', {