From 3a35d2181d6643b0039449680288c0b2ca2d18e9 Mon Sep 17 00:00:00 2001 From: Sirttas Date: Sat, 13 Jun 2026 14:36:00 +0200 Subject: [PATCH] cleanup and fix --- src/market/appraisal/appraisal.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/market/appraisal/appraisal.ts b/src/market/appraisal/appraisal.ts index 048d81a..18ab28f 100644 --- a/src/market/appraisal/appraisal.ts +++ b/src/market/appraisal/appraisal.ts @@ -6,6 +6,7 @@ import { MarketTypePrice } from './MarketTypePrice'; import { getMammonPrices } from './mammon'; const cacheDuration = 1000 * 60 * 5; // 5 minutes +const batchSize = 100; export const useApraisalStore = defineStore('appraisal', () => { const cache: RegionalMarketCache = new RegionalMarketCache(cacheDuration); @@ -29,7 +30,13 @@ export const useApraisalStore = defineStore('appraisal', () => { }); if (uncached.length > 0) { - const prices = await getPricesUncached(uncached); + const batches: Promise[] = []; + + for (let i = 0; i < uncached.length; i += batchSize) { + batches.push(getPricesUncached(uncached.slice(i, i + batchSize))); + } + + const prices = (await Promise.all(batches)).flat(); prices.forEach(p => cache.set(rId, p.type.id, p)); return [ ...cached, ...prices ];