Skip to content

Commit

Permalink
fix: move away from updating chunks of relay hash info rows (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
amateima authored Dec 16, 2024
1 parent 931a665 commit 7dbf691
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/indexer/src/services/spokePoolProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,18 @@ export class SpokePoolProcessor {
}),
};
});
const chunkedData = utils.chunk(data, this.queryBatchSize);
const upsertResult = await Promise.all(
chunkedData.map((chunk) =>
relayHashInfoRepository.upsert(chunk, ["relayHash"]),
),
);

const upsertResults = [];
for (const item of data) {
upsertResults.push(
await relayHashInfoRepository.upsert(item, ["relayHash"]),
);
}

this.logger.debug({
at: "Indexer#SpokePoolProcessor#assignSpokeEventsToRelayHashInfo",
message: `${eventType} events associated with RelayHashInfo`,
updatedRelayHashInfoRows: upsertResult.reduce(
updatedRelayHashInfoRows: upsertResults.reduce(
(acc, res) => acc + res.generatedMaps.length,
0,
),
Expand Down

0 comments on commit 7dbf691

Please sign in to comment.