Skip to content

Commit

Permalink
common: Reduce stringency of action validation when adding to queue
Browse files Browse the repository at this point in the history
- Specifically: remove the check that the deployment is published to the
network to avoid race conditions waiting for the network subgraph to
update
  • Loading branch information
fordN committed Dec 12, 2023
1 parent 0c995ad commit 8d6f057
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/indexer-common/src/actions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { NetworkMonitor } from './indexer-management'
import { AllocationStatus } from './allocations'
import { Logger } from '@graphprotocol/common-ts'
import { WhereOperators, WhereOptions } from 'sequelize'
import { Op } from 'sequelize'
import { WhereAttributeHashValue } from 'sequelize/types/model'
Expand Down Expand Up @@ -81,6 +82,7 @@ export const isValidActionInput = (
export const validateActionInputs = async (
actions: ActionInput[],
networkMonitor: NetworkMonitor,
logger: Logger,
): Promise<void> => {
// Validate actions before adding to queue
// TODO: Perform all checks simultaneously and throw combined error if 1 or more fail
Expand Down Expand Up @@ -125,7 +127,7 @@ export const validateActionInputs = async (
action.deploymentID,
)
if (!subgraphDeployment) {
throw new Error(
logger.warn(
`No subgraphDeployment with ipfsHash = '${action.deploymentID}' found on the network`,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export default {
await multiNetworks.mapNetworkMapped(
groupBy(actions, (action) => action.protocolNetwork),
(network: Network, actions: ActionInput[]) =>
validateActionInputs(actions, network.networkMonitor),
validateActionInputs(actions, network.networkMonitor, logger),
)

const alreadyQueuedActions = await ActionManager.fetchActions(models, {
Expand Down

0 comments on commit 8d6f057

Please sign in to comment.