Skip to content

Commit

Permalink
*: Only allow setting parallelAllocations to 1, preparing to deprecate
Browse files Browse the repository at this point in the history
  • Loading branch information
fordN committed Sep 2, 2021
1 parent c9fbade commit 89be9a7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
15 changes: 7 additions & 8 deletions docs/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions packages/indexer-cli/src/commands/indexer/rules/set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 89be9a7

Please sign in to comment.