Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Theodus committed Feb 29, 2024
1 parent a9e3eca commit 3a3f040
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions packages/indexer-service/src/allocations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,16 @@ export const monitorEligibleAllocations = ({
{
indexer: indexer.toLowerCase(),
lastId,
})
},
)

if (result.error) {
throw result.error
}
if (result.data.length == 0) {
break
}
activeAllocations.push(result.data.allocations);
activeAllocations.push(result.data.allocations)
lastId = result.data.allocations.slice(-1)[0].id
}

Expand Down Expand Up @@ -147,32 +148,27 @@ export const monitorEligibleAllocations = ({
indexer: indexer.toLowerCase(),
lastId,
closedAtEpochThreshold: currentEpoch - 1, // allocation can be closed within the last epoch or later
})
},
)

if (result.error) {
throw result.error
}
if (result.data.length == 0) {
break
}
recentlyClosedAllocations.push(result.data.allocations);
recentlyClosedAllocations.push(result.data.allocations)
lastId = result.data.allocations.slice(-1)[0].id
}

const allocations = [
...activeAllocations,
...recentlyClosedAllocations,
]
const allocations = [...activeAllocations, ...recentlyClosedAllocations]

if (allocations.length == 0) {
throw new Error(`No data / indexer not found on chain`)
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
return [
...activeAllocations,
...recentlyClosedAllocations,
].map(x => parseGraphQLAllocation(x, protocolNetwork))
return allocations.map(x => parseGraphQLAllocation(x, protocolNetwork))
} catch (err) {
logger.warn(`Failed to query indexer allocations, keeping existing`, {
allocations: currentAllocations.map(allocation => allocation.id),
Expand Down

0 comments on commit 3a3f040

Please sign in to comment.