aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-10-14 23:58:38 +0200
committerLinnea Gräf <nea@nea.moe>2025-10-14 23:58:38 +0200
commitf6c0f4ca1573b8b0daa3fb4fb00e927f97f5f45c (patch)
tree23ff9e381d45cf31d0a8471a830c40c9fd3cf33e /src
parent2ed4f2d23f70ab6da46edf504371cb6b238c802e (diff)
downloadFirmament-f6c0f4ca1573b8b0daa3fb4fb00e927f97f5f45c.tar.gz
Firmament-f6c0f4ca1573b8b0daa3fb4fb00e927f97f5f45c.tar.bz2
Firmament-f6c0f4ca1573b8b0daa3fb4fb00e927f97f5f45c.zip
feat: decrease price cache lifetime
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/repo/HypixelStaticData.kt21
1 files changed, 11 insertions, 10 deletions
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() {