Skip to content

Commit

Permalink
fix list search object being created outside of cocos thread
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Sep 28, 2024
1 parent f9152e3 commit a863678
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/managers/BetterInfoCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,16 +314,18 @@ void BetterInfoCache::downloadClaimableLists() {

std::thread([this, toDownload = std::move(toDownload)] {
for(auto listID : toDownload) {
auto searchObj = GJSearchObject::create(SearchType::Search, std::to_string(listID));
ServerUtils::getLevelLists(
searchObj,
[this](auto lists, bool) {
if(lists->empty()) return;
m_claimableLists[lists->at(0)->m_listID] = lists->at(0);
log::debug("Downloaded list {}", lists->at(0)->m_listID);
},
false
);
Loader::get()->queueInMainThread([this, listID] {
auto searchObj = GJSearchObject::create(SearchType::Search, std::to_string(listID));
ServerUtils::getLevelLists(
searchObj,
[this](auto lists, bool) {
if(lists->empty()) return;
m_claimableLists[lists->at(0)->m_listID] = lists->at(0);
log::debug("Downloaded list {}", lists->at(0)->m_listID);
},
false
);log::debug("Downloading list {}", listID);
});

using namespace std::chrono_literals;
std::this_thread::sleep_for(1000ms);
Expand Down

0 comments on commit a863678

Please sign in to comment.