Skip to content

Commit

Permalink
adjust cache rate limits
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Jul 7, 2024
1 parent 76400d9 commit 0f5885b
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/managers/BetterInfoCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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() {
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit 0f5885b

Please sign in to comment.