From f6c0f4ca1573b8b0daa3fb4fb00e927f97f5f45c Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Tue, 14 Oct 2025 23:58:38 +0200 Subject: feat: decrease price cache lifetime --- src/main/kotlin/repo/HypixelStaticData.kt | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/main/kotlin/repo/HypixelStaticData.kt') diff --git a/src/main/kotlin/repo/HypixelStaticData.kt b/src/main/kotlin/repo/HypixelStaticData.kt index ed37054..d6be96f 100644 --- a/src/main/kotlin/repo/HypixelStaticData.kt +++ b/src/main/kotlin/repo/HypixelStaticData.kt @@ -59,7 +59,8 @@ object HypixelStaticData { ) - fun getPriceOfItem(item: SkyblockId): Double? = bazaarData[SkyblockId.BazaarStock.fromSkyBlockId(item)]?.quickStatus?.buyPrice ?: lowestBin[item] + fun getPriceOfItem(item: SkyblockId): Double? = + bazaarData[SkyblockId.BazaarStock.fromSkyBlockId(item)]?.quickStatus?.buyPrice ?: lowestBin[item] fun hasBazaarStock(item: SkyblockId.BazaarStock): Boolean { return item in bazaarData @@ -77,17 +78,17 @@ object HypixelStaticData { Firmament.coroutineScope.launch { while (true) { logger.info("Updating NEU prices") - updatePrices() - delay(10.minutes) + fetchPricesFromMoulberry() + delay(5.minutes) + } + } + Firmament.coroutineScope.launch { + while (true) { + logger.info("Updating bazaar prices") + fetchBazaarPrices() + delay(2.minutes) } } - } - - private suspend fun updatePrices() { - awaitAll( - Firmament.coroutineScope.async { fetchBazaarPrices() }, - Firmament.coroutineScope.async { fetchPricesFromMoulberry() }, - ) } private suspend fun fetchPricesFromMoulberry() { -- cgit