Skip to content

Commit 99d1a15

Browse files
committed
chore: deploy dips deployments even in MANUAL mode
1 parent 2695781 commit 99d1a15

File tree

2 files changed

+48
-5
lines changed

2 files changed

+48
-5
lines changed

packages/indexer-agent/src/agent.ts

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,14 +262,15 @@ export class Agent {
262262
},
263263
)
264264

265-
// Skip fetching active deployments if the deployment management mode is manual and POI tracking is disabled
265+
// Skip fetching active deployments if the deployment management mode is manual, DIPs is disabled, and POI tracking is disabled
266266
const activeDeployments: Eventual<SubgraphDeploymentID[]> =
267267
sequentialTimerMap(
268268
{ logger, milliseconds: requestIntervalLarge },
269269
async () => {
270270
if (
271271
this.deploymentManagement === DeploymentManagementMode.AUTO ||
272-
network.networkMonitor.poiDisputeMonitoringEnabled()
272+
network.networkMonitor.poiDisputeMonitoringEnabled() ||
273+
network.specification.indexerOptions.enableDips
273274
) {
274275
logger.trace('Fetching active deployments')
275276
const assignments =
@@ -497,9 +498,40 @@ export class Agent {
497498
}
498499
break
499500
case DeploymentManagementMode.MANUAL:
500-
this.logger.debug(
501-
`Skipping subgraph deployment reconciliation since DeploymentManagementMode = 'manual'`,
502-
)
501+
if (network.specification.indexerOptions.enableDips) {
502+
// Reconcile DIPs deployments anyways
503+
this.logger.warn(
504+
`Deployment management is manual, but DIPs is enabled. Reconciling DIPs deployments anyways.`,
505+
)
506+
if (!operator.dipsManager) {
507+
throw new Error('DipsManager is not available')
508+
}
509+
const dipsDeployments =
510+
await operator.dipsManager.getActiveDipsDeployments()
511+
const newTargetDeployments = new Set([
512+
...activeDeployments,
513+
...dipsDeployments,
514+
])
515+
try {
516+
await this.reconcileDeployments(
517+
activeDeployments,
518+
Array.from(newTargetDeployments),
519+
eligibleAllocations,
520+
)
521+
} catch (err) {
522+
logger.warn(
523+
`Exited early while reconciling deployments. Skipped reconciling actions.`,
524+
{
525+
err: indexerError(IndexerErrorCode.IE005, err),
526+
},
527+
)
528+
return
529+
}
530+
} else {
531+
this.logger.debug(
532+
`Skipping subgraph deployment reconciliation since DeploymentManagementMode = 'manual'`,
533+
)
534+
}
503535
break
504536
default:
505537
throw new Error(

packages/indexer-common/src/indexing-fees/dips.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ export class DipsManager {
135135
}
136136
}
137137
}
138+
async getActiveDipsDeployments(): Promise<SubgraphDeploymentID[]> {
139+
// Get all the indexing agreements that are not cancelled
140+
const indexingAgreements = await this.models.IndexingAgreement.findAll({
141+
where: {
142+
cancelled_at: null,
143+
},
144+
})
145+
return indexingAgreements.map(
146+
(agreement) => new SubgraphDeploymentID(agreement.subgraph_deployment_id),
147+
)
148+
}
138149
}
139150

140151
export class DipsCollector {

0 commit comments

Comments
 (0)