Skip to content

Commit

Permalink
fix some type issues and format
Browse files Browse the repository at this point in the history
  • Loading branch information
saihaj committed Aug 6, 2024
1 parent 3269c95 commit 0ca52d4
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 30 deletions.
57 changes: 30 additions & 27 deletions packages/indexer-agent/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,33 +281,36 @@ export class Agent {
},
)

const indexingRules: Eventual< NetworkMapped<GeneratedGraphQLTypes.IndexingRule[]>> =
timer(requestIntervalSmall).tryMap(
async () => {
return this.multiNetworks.map(async ({ network, operator }) => {
logger.trace('Fetching indexing rules', {
protocolNetwork: network.specification.networkIdentifier,
})
let rules = await operator.indexingRules(true)
const subgraphRuleIds = rules
.filter(
rule => rule.identifierType == GeneratedGraphQLTypes.IdentifierType.subgraph,
)
.map(rule => rule.identifier!)
const subgraphsMatchingRules =
await network.networkMonitor.subgraphs(subgraphRuleIds)
if (subgraphsMatchingRules.length >= 1) {
const epochLength =
await network.contracts.epochManager.epochLength()
const blockPeriod = 15
const bufferPeriod = epochLength.toNumber() * blockPeriod * 100 // 100 epochs
rules = convertSubgraphBasedRulesToDeploymentBased(
rules,
subgraphsMatchingRules,
bufferPeriod,
)
}
return rules
const indexingRules: Eventual<
NetworkMapped<GeneratedGraphQLTypes.IndexingRule[]>
> = timer(requestIntervalSmall).tryMap(
async () => {
return this.multiNetworks.map(async ({ network, operator }) => {
logger.trace('Fetching indexing rules', {
protocolNetwork: network.specification.networkIdentifier,
})
let rules = await operator.indexingRules(true)
const subgraphRuleIds = rules
.filter(
rule =>
rule.identifierType ==
GeneratedGraphQLTypes.IdentifierType.subgraph,
)
.map(rule => rule.identifier!)
const subgraphsMatchingRules =
await network.networkMonitor.subgraphs(subgraphRuleIds)
if (subgraphsMatchingRules.length >= 1) {
const epochLength =
await network.contracts.epochManager.epochLength()
const blockPeriod = 15
const bufferPeriod = epochLength.toNumber() * blockPeriod * 100 // 100 epochs
rules = convertSubgraphBasedRulesToDeploymentBased(
rules,
subgraphsMatchingRules,
bufferPeriod,
)
}
return rules
})
},
{
Expand Down
4 changes: 2 additions & 2 deletions packages/indexer-agent/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
Network,
GraphNode,
DeploymentManagementMode,
IndexerManagementClient,
IndexerManagementYogaClient,
Operator,
} from '@graphprotocol/indexer-common'

Expand All @@ -19,7 +19,7 @@ export interface AgentConfigs {
metrics: Metrics
graphNode: GraphNode
operators: Operator[]
indexerManagement: IndexerManagementClient
indexerManagement: IndexerManagementYogaClient
networks: Network[]
deploymentManagement: DeploymentManagementMode
autoMigrationSupport: boolean
Expand Down
2 changes: 1 addition & 1 deletion packages/indexer-cli/src/allocations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export const reallocateAllocation = async (
}

export const submitCollectReceiptsJob = async (
client: IndexerManagementClient,
client: Client,
allocationID: string,
protocolNetwork: string,
): Promise<void> => {
Expand Down

0 comments on commit 0ca52d4

Please sign in to comment.