From 0f5885b3d43089d39af2c27db1da1a3a1811378c Mon Sep 17 00:00:00 2001 From: Cvolton Date: Sun, 7 Jul 2024 23:46:16 +0200 Subject: [PATCH] adjust cache rate limits --- src/managers/BetterInfoCache.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/managers/BetterInfoCache.cpp b/src/managers/BetterInfoCache.cpp index 2d8f5ac..b0031fb 100644 --- a/src/managers/BetterInfoCache.cpp +++ b/src/managers/BetterInfoCache.cpp @@ -3,6 +3,7 @@ #include "../utils.hpp" #include "../layers/FoundListsPopup.h" +#include "Geode/utils/general.hpp" bool BetterInfoCache::init(){ if(!BaseJsonManager::init("cache.json")) return false; @@ -14,16 +15,31 @@ bool BetterInfoCache::init(){ void BetterInfoCache::finishLoading(){ auto now = BetterInfo::timeInMs(); - auto GLM = GameLevelManager::sharedState(); checkClaimableLists(); cacheRatedLists(); cacheFollowedCreators(); - checkLevelsFromDict(GLM->m_onlineLevels); - checkLevelsFromDict(GLM->m_dailyLevels); - log::debug("Finished 2nd stage loading BetterInfoCache in {} ms", BetterInfo::timeInMs() - now); + + std::thread([this] { + thread::setName("BI 3rd Stage Sleep"); + using namespace std::chrono_literals; + std::this_thread::sleep_for(120000ms); + + Loader::get()->queueInMainThread([this] { + auto now = BetterInfo::timeInMs(); + log::debug("Starting 3rd stage loading BetterInfoCache"); + + auto GLM = GameLevelManager::sharedState(); + checkLevelsFromDict(GLM->m_onlineLevels); + checkLevelsFromDict(GLM->m_dailyLevels); + + log::debug("Finished 3rd stage loading BetterInfoCache in {} ms", BetterInfo::timeInMs() - now); + }); + }).detach(); + + } void BetterInfoCache::validateLoadedData() { @@ -65,7 +81,7 @@ void BetterInfoCache::cacheFollowedCreators() { }); using namespace std::chrono_literals; - std::this_thread::sleep_for(500ms); + std::this_thread::sleep_for(5000ms); } }).detach(); }