Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/indexer-agent/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,10 @@ export class Agent {
.rule?.allocationLifetime
? deploymentAllocationDecision.ruleMatch.rule.allocationLifetime
: maxAllocationDuration
return epoch >= allocation.createdAtEpoch + desiredAllocationLifetime

const lastCollectedEpoch =
allocation.lastPresentedPoiEpoch ?? allocation.createdAtEpoch
return epoch >= lastCollectedEpoch + desiredAllocationLifetime
},
)
logger.debug('Expired allocations found', {
Expand Down
1 change: 1 addition & 0 deletions packages/indexer-common/src/allocations/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface Allocation {
poi: string | undefined
queryFeeRebates: bigint | undefined
queryFeesCollected: bigint | undefined
lastPresentedPoiEpoch: number | undefined
}

export interface Provision {
Expand Down
3 changes: 3 additions & 0 deletions packages/indexer-common/src/indexer-management/monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ export class NetworkMonitor {
closedAt
closedAtEpoch
createdAtBlockHash
pois(first: 1, orderBy: submittedAtEpoch, orderDirection: desc) {
submittedAtEpoch
}
subgraphDeployment {
id
stakedTokens
Expand Down
1 change: 1 addition & 0 deletions packages/indexer-common/src/indexer-management/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export const parseGraphQLAllocation = (
poi: allocation.poi,
queryFeeRebates: allocation.queryFeeRebates,
queryFeesCollected: allocation.queryFeesCollected,
lastPresentedPoiEpoch: allocation.pois?.[0]?.submittedAtEpoch,
})

export const parseGraphQLProvision = (provision: any): Provision => ({
Expand Down
Loading