Skip to content

Commit

Permalink
chunk get multiple accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
NourAlharithi committed Jan 20, 2025
1 parent ca60e39 commit 5467805
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/bots/pythCranker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,19 @@ export class PythCrankerBot implements Bot {
}

async runCrankLoop() {
const onChainDataResults =
await this.driftClient.connection.getMultipleAccountsInfo(
this.feedIdsToCrank.map((f) => f.accountAddress)
);
const feedIdsToCrankAddressChunks = chunks(
this.feedIdsToCrank.map((f) => f.accountAddress),
50
);
const onChainDataResults = (
await Promise.all(
feedIdsToCrankAddressChunks.map(async (feedIdsToCrankAddressChunk) => {
return this.driftClient.connection.getMultipleAccountsInfo(
feedIdsToCrankAddressChunk
);
})
)
).flat();

const latestSlot = await this.driftClient.connection.getSlot();
let numFeedsSignalingRestart = 0;
Expand Down

0 comments on commit 5467805

Please sign in to comment.