Skip to content

Commit

Permalink
start bi 3rd stage loading immediately after followed creators are ca…
Browse files Browse the repository at this point in the history
…ched
  • Loading branch information
Cvolton committed Nov 17, 2024
1 parent 3c7650e commit dfe97e8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
28 changes: 12 additions & 16 deletions src/managers/BetterInfoCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,17 @@ void BetterInfoCache::finishLoading(){
cacheFollowedCreators();

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);
void BetterInfoCache::thirdStageLoading() {
auto now = BetterInfo::timeInMs();
log::debug("Starting 3rd stage loading BetterInfoCache");

log::debug("Finished 3rd stage loading BetterInfoCache in {} ms", BetterInfo::timeInMs() - now);
});
}).detach();
auto GLM = GameLevelManager::sharedState();
checkLevelsFromDict(GLM->m_onlineLevels);
checkLevelsFromDict(GLM->m_dailyLevels);


log::debug("Finished 3rd stage loading BetterInfoCache in {} ms", BetterInfo::timeInMs() - now);
}

void BetterInfoCache::validateLoadedData() {
Expand Down Expand Up @@ -88,6 +80,10 @@ void BetterInfoCache::cacheFollowedCreators() {
using namespace std::chrono_literals;
std::this_thread::sleep_for(5000ms);
}

Loader::get()->queueInMainThread([this] {
thirdStageLoading();
});
}).detach();
}

Expand Down
1 change: 1 addition & 0 deletions src/managers/BetterInfoCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class BI_DLL BetterInfoCache : public BaseJsonManager {

bool init();
void finishLoading();
void thirdStageLoading();

void validateLoadedData();
void establishCachedDicts();
Expand Down

0 comments on commit dfe97e8

Please sign in to comment.