Skip to content

Commit cfb6ec6

Browse files
committed
common, agent: fix active deployment query
1 parent 5f4b79e commit cfb6ec6

File tree

2 files changed

+17
-28
lines changed

2 files changed

+17
-28
lines changed

packages/indexer-agent/src/agent.ts

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -329,33 +329,24 @@ export class Agent {
329329
sequentialTimerMap(
330330
{ logger, milliseconds: requestIntervalLarge },
331331
async () => {
332-
const deployments = await this.multiNetworks.map(
333-
async ({ network }) => {
334-
if (
335-
this.deploymentManagement === DeploymentManagementMode.AUTO ||
336-
network.networkMonitor.poiDisputeMonitoringEnabled()
337-
) {
338-
logger.trace('Fetching active deployments')
339-
const assignments =
340-
await this.graphNode.subgraphDeploymentsAssignments(
341-
SubgraphStatus.ACTIVE,
342-
)
343-
return assignments.map(assignment => assignment.id)
344-
} else {
345-
logger.info(
346-
"Skipping fetching active deployments fetch since DeploymentManagementMode = 'manual' and POI tracking is disabled",
347-
)
348-
return []
349-
}
350-
},
351-
)
352-
return deployments.values
332+
if (this.deploymentManagement === DeploymentManagementMode.AUTO) {
333+
logger.debug('Fetching active deployments')
334+
const assignments =
335+
await this.graphNode.subgraphDeploymentsAssignments(
336+
SubgraphStatus.ACTIVE,
337+
)
338+
return assignments.map(assignment => assignment.id)
339+
} else {
340+
logger.info(
341+
"Skipping fetching active deployments fetch since DeploymentManagementMode = 'manual' and POI tracking is disabled",
342+
)
343+
return []
344+
}
353345
},
354346
{
355347
onError: error =>
356348
logger.warn(
357-
`Failed to obtain active deployments, trying again later`,
358-
{ error },
349+
`Failed to obtain active deployments, trying again later ${error}`,
359350
),
360351
},
361352
)
@@ -554,7 +545,6 @@ export class Agent {
554545
networkDeploymentAllocationDecisions,
555546
}).tryMap(
556547
async ({ indexingRules, networkDeploymentAllocationDecisions }) => {
557-
logger.trace('Resolving target deployments')
558548
const targetDeploymentIDs: Set<SubgraphDeploymentID> =
559549
consolidateAllocationDecisions(networkDeploymentAllocationDecisions)
560550

@@ -576,8 +566,7 @@ export class Agent {
576566
{
577567
onError: error =>
578568
logger.warn(
579-
`Failed to obtain target deployments, trying again later`,
580-
{ error },
569+
`Failed to obtain target deployments, trying again later ${error}`,
581570
),
582571
},
583572
)

packages/indexer-common/src/sequential-timer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export function sequentialTimerReduce<T, U>(
9393
}
9494
}
9595
// initial call
96-
setTimeout(work, milliseconds)
96+
work()
9797
return output
9898
}
9999

@@ -152,6 +152,6 @@ export function sequentialTimerMap<U>(
152152
}
153153

154154
// initial call
155-
setTimeout(work, milliseconds)
155+
work()
156156
return output
157157
}

0 commit comments

Comments
 (0)