Jelajahi Sumber

buy: stop making FIO requsets in parallel

this was causing timeouts
raylu 2 minggu lalu
induk
melakukan
56847b8264
1 mengubah file dengan 4 tambahan dan 6 penghapusan
  1. 4 6
      ts/buy.ts

+ 4 - 6
ts/buy.ts

@@ -34,12 +34,10 @@ document.querySelector('#copy-xit-act')!.addEventListener('click', () => {
 setupPopover();
 
 async function calculate(username: string, apiKey: string, supplyForDays: number, cx: keyof typeof warehouseNames): Promise<void> {
-	const [prices, planets, avail, {bids, orders}] = await Promise.all([
-		getPrices(cx),
-		getPlanets(username, apiKey),
-		warehouseInventory(username, apiKey, warehouseNames[cx]),
-		getBids(username, apiKey, cx)
-	]);
+	const prices = await getPrices(cx);
+	const planets = await getPlanets(username, apiKey);
+	const avail = await warehouseInventory(username, apiKey, warehouseNames[cx]);
+	const {bids, orders} = await getBids(username, apiKey, cx);
 	const buy = new Map<string, number>();
 	for (const planet of planets) {
 		for (const [mat, amount] of planet.supplyForDays(supplyForDays))