Skip to content

Commit 5be3fe6

Browse files
committed
common: drive getPendingRAVs from allocations eventual instead of re-querying, disable jsonify of allocations
1 parent 976f4f4 commit 5be3fe6

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

packages/indexer-common/src/allocations/tap-collector.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
allocationSigner,
2222
tapAllocationIdProof,
2323
parseGraphQLAllocation,
24-
sequentialTimerMap,
2524
} from '..'
2625
import { BigNumber } from 'ethers'
2726
import pReduce from 'p-reduce'
@@ -184,12 +183,8 @@ export class TapCollector {
184183
}
185184

186185
private getPendingRAVs(): Eventual<RavWithAllocation[]> {
187-
return sequentialTimerMap(
188-
{
189-
logger: this.logger,
190-
milliseconds: RAV_CHECK_INTERVAL_MS,
191-
},
192-
async () => {
186+
return this.allocations.throttle(RAV_CHECK_INTERVAL_MS).tryMap(
187+
async (allocations) => {
193188
let ravs = await this.pendingRAVs()
194189
if (ravs.length === 0) {
195190
this.logger.info(`No pending RAVs to process`)
@@ -198,10 +193,10 @@ export class TapCollector {
198193
if (ravs.length > 0) {
199194
ravs = await this.filterAndUpdateRavs(ravs)
200195
}
201-
const allocations: Allocation[] = await this.getAllocationsfromAllocationIds(ravs)
202-
this.logger.info(
203-
`Retrieved allocations for pending RAVs \n: ${JSON.stringify(allocations)}`,
204-
)
196+
this.logger.debug(`matching allocations for pending ravs`, {
197+
allocationCount: allocations.length,
198+
ravCount: ravs.length,
199+
})
205200
return ravs
206201
.map((rav) => {
207202
const signedRav = rav.getSignedRAV()

0 commit comments

Comments
 (0)