Skip to content

Commit

Permalink
fix: batch size/timing
Browse files Browse the repository at this point in the history
  • Loading branch information
crnbarr93 committed Aug 23, 2024
1 parent 7c1169b commit a9b1f16
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/trpc/src/orderbook-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const orderbookRouter = createTRPCRouter({
const contractAddresses = pools.map((p) => p.contractAddress);
if (contractAddresses.length === 0 || userOsmoAddress.length === 0)
return [];
const batchSize = 5; // Define the batch size
const batchSize = 10; // Define the batch size
const batches = contractAddresses.reduce((acc: any[], _, index) => {
const batchIndex = Math.floor(index / batchSize);
if (!acc[batchIndex]) {
Expand Down Expand Up @@ -113,7 +113,7 @@ export const orderbookRouter = createTRPCRouter({
}
const batchOrders = await Promise.all(promises);
allOrders.push(...batchOrders.flat());
await new Promise((resolve) => setTimeout(resolve, 250));
await new Promise((resolve) => setTimeout(resolve, 500));
}
// promises.push(
// getOrderbookHistoricalOrders({
Expand Down

0 comments on commit a9b1f16

Please sign in to comment.