From 6850b54f0e3633762c76d74a7a427999c6a463d5 Mon Sep 17 00:00:00 2001 From: Daniel Werner Date: Thu, 26 Dec 2024 16:38:35 -0800 Subject: [PATCH] common: drive getPendingRAVs from allocations eventual instead of re-querying, disable jsonify of allocations --- .../indexer-common/src/allocations/tap-collector.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/packages/indexer-common/src/allocations/tap-collector.ts b/packages/indexer-common/src/allocations/tap-collector.ts index 90c4f7ca6..ebb195ef5 100644 --- a/packages/indexer-common/src/allocations/tap-collector.ts +++ b/packages/indexer-common/src/allocations/tap-collector.ts @@ -21,7 +21,6 @@ import { allocationSigner, tapAllocationIdProof, parseGraphQLAllocation, - sequentialTimerMap, } from '..' import { BigNumber } from 'ethers' import pReduce from 'p-reduce' @@ -184,12 +183,8 @@ export class TapCollector { } private getPendingRAVs(): Eventual { - return sequentialTimerMap( - { - logger: this.logger, - milliseconds: RAV_CHECK_INTERVAL_MS, - }, - async () => { + return this.allocations.throttle(RAV_CHECK_INTERVAL_MS).tryMap( + async (allocations) => { let ravs = await this.pendingRAVs() if (ravs.length === 0) { this.logger.info(`No pending RAVs to process`) @@ -198,10 +193,6 @@ export class TapCollector { if (ravs.length > 0) { ravs = await this.filterAndUpdateRavs(ravs) } - const allocations: Allocation[] = await this.getAllocationsfromAllocationIds(ravs) - this.logger.info( - `Retrieved allocations for pending RAVs \n: ${JSON.stringify(allocations)}`, - ) return ravs .map((rav) => { const signedRav = rav.getSignedRAV()