market types from mammon
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { RegionalMarketCache } from '../RegionalMarketCache';
|
||||
import { jitaId } from '../market';
|
||||
import { MarketType } from "../type";
|
||||
import { MarketTypePrice } from './MarketTypePrice';
|
||||
import { getMammonPrices } from './mammon';
|
||||
import {defineStore} from 'pinia';
|
||||
import {RegionalMarketCache} from '../RegionalMarketCache';
|
||||
import {jitaId} from '../market';
|
||||
import {MarketType} from "../type";
|
||||
import {MarketTypePrice} from './MarketTypePrice';
|
||||
import {getMammonPrices} from './mammon';
|
||||
|
||||
const cacheDuration = 1000 * 60 * 5; // 5 minutes
|
||||
const batchSize = 100;
|
||||
const CACHE_DURATION = 1000 * 60 * 5; // 5 minutes
|
||||
const BATCH_SIZE = 100;
|
||||
|
||||
export const useApraisalStore = defineStore('appraisal', () => {
|
||||
const cache: RegionalMarketCache<MarketTypePrice> = new RegionalMarketCache(cacheDuration);
|
||||
const cache: RegionalMarketCache<MarketTypePrice> = new RegionalMarketCache(CACHE_DURATION);
|
||||
|
||||
const getPricesUncached = getMammonPrices;
|
||||
|
||||
@@ -32,8 +32,8 @@ export const useApraisalStore = defineStore('appraisal', () => {
|
||||
if (uncached.length > 0) {
|
||||
const batches: Promise<MarketTypePrice[]>[] = [];
|
||||
|
||||
for (let i = 0; i < uncached.length; i += batchSize) {
|
||||
batches.push(getPricesUncached(uncached.slice(i, i + batchSize)));
|
||||
for (let i = 0; i < uncached.length; i += BATCH_SIZE) {
|
||||
batches.push(getPricesUncached(uncached.slice(i, i + BATCH_SIZE)));
|
||||
}
|
||||
|
||||
const prices = (await Promise.all(batches)).flat();
|
||||
|
||||
Reference in New Issue
Block a user