From 89be9a7fba3cd427f76bfb87580ab5b59c02a21e Mon Sep 17 00:00:00 2001 From: Ford Date: Mon, 23 Aug 2021 18:12:47 -0700 Subject: [PATCH] *: Only allow setting parallelAllocations to 1, preparing to deprecate --- docs/errors.md | 15 +++++++-------- .../indexer-cli/src/commands/indexer/rules/set.ts | 4 ++++ .../indexer-management/models/indexing-rule.ts | 7 +++++++ .../resolvers/indexer-status.ts | 1 + 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/docs/errors.md b/docs/errors.md index f5911216c..64b3e4f4c 100644 --- a/docs/errors.md +++ b/docs/errors.md @@ -114,10 +114,9 @@ to be reported. Make sure that - Indexer agent can connect and deploy to the graph/index node or nodes fine. - The indexer has sufficient ETH. - The indexer has sufficient free stake to create new allocations. If this is - the case, reduce the allocation amount and/or parallel allocations on some - of the deployments in the indexing rules and wait until some of the existing - allocations have been closed and have released the allocated GRT again. In - this case, the situation should resolve automatically. + the case, reduce the allocation amount until some of the existing + allocations have been closed and have released the allocated GRT again. + In this case, the situation should resolve automatically. ## IE006 @@ -230,10 +229,10 @@ for creating new allocations **Solution** The indexer has sufficient free stake to create new allocations. If this is -the case, reduce the allocation amount and/or parallel allocations on some of -the deployments in the indexing rules and wait until some of the existing -allocations have been closed and have released the allocated GRT again. In -this case, the situation should resolve automatically. +the case, reduce the allocation amount on some of the deployments in the +indexing rules and wait until some of the existing allocations have been +closed and have released the allocated GRT again. In this case, the +situation should resolve automatically. ## IE014 diff --git a/packages/indexer-cli/src/commands/indexer/rules/set.ts b/packages/indexer-cli/src/commands/indexer/rules/set.ts index e4536a281..502748280 100644 --- a/packages/indexer-cli/src/commands/indexer/rules/set.ts +++ b/packages/indexer-cli/src/commands/indexer/rules/set.ts @@ -74,6 +74,10 @@ module.exports = { deployment, }) + if (inputRule.parallelAllocations && inputRule.parallelAllocations >= 2) { + throw Error ('Parallel allocations are soon to be fully deprecated. Please set parallel allocations to 1 for all your indexing rules') + } + // Update the indexing rule according to the key/value pairs try { const client = await createIndexerManagementClient({ url: config.api }) diff --git a/packages/indexer-common/src/indexer-management/models/indexing-rule.ts b/packages/indexer-common/src/indexer-management/models/indexing-rule.ts index 0027d4d8d..8c690ae12 100644 --- a/packages/indexer-common/src/indexer-management/models/indexing-rule.ts +++ b/packages/indexer-common/src/indexer-management/models/indexing-rule.ts @@ -140,6 +140,13 @@ export const defineIndexingRuleModels = (sequelize: Sequelize): IndexingRuleMode validate: { min: 0, max: 20, + emitDeprecationWarning: (value: number) => { + if (value > 1) { + throw new Error( + 'Parallel allocations are soon to be fully deprecated. Please set parallel allocations to 1 for all your indexing rules', + ) + } + }, }, }, maxAllocationPercentage: { diff --git a/packages/indexer-common/src/indexer-management/resolvers/indexer-status.ts b/packages/indexer-common/src/indexer-management/resolvers/indexer-status.ts index f5a7edc27..541845bf8 100644 --- a/packages/indexer-common/src/indexer-management/resolvers/indexer-status.ts +++ b/packages/indexer-common/src/indexer-management/resolvers/indexer-status.ts @@ -120,6 +120,7 @@ export default { if (result.error) { throw new Error(`Falied to query allocations: ${result.error}`) } + // eslint-disable-next-line @typescript-eslint/no-explicit-any return result.data.indexer.allocations.map((allocation: any) => ({ ...allocation, subgraphDeployment: new SubgraphDeploymentID(allocation.subgraphDeployment.id)