forked from MrBesen/lolautoaccept
datadragon: more logging, do not refresh cache when it was read
This commit is contained in:
parent
bb4555585e
commit
97a822746e
|
@ -281,7 +281,8 @@ void DataDragon::getChampsInternal() {
|
|||
}
|
||||
|
||||
QJsonDocument jchamps = champCache.getChamps();
|
||||
if(jchamps.isEmpty()) {
|
||||
bool cacheSuccessfull = !jchamps.isEmpty();
|
||||
if(!cacheSuccessfull) {
|
||||
jchamps = request(getCDNString() + "data/" + locale + "/champion.json");
|
||||
if(jchamps.isEmpty()) {
|
||||
// try again with default locale
|
||||
|
@ -291,7 +292,9 @@ void DataDragon::getChampsInternal() {
|
|||
}
|
||||
if(jchamps.isObject()) {
|
||||
// save to cache
|
||||
champCache.saveChamps(jchamps, version);
|
||||
if(!cacheSuccessfull) {
|
||||
champCache.saveChamps(jchamps, version);
|
||||
}
|
||||
|
||||
QJsonObject obj = jchamps.object();
|
||||
auto it = obj.constFind("data");
|
||||
|
@ -305,7 +308,7 @@ void DataDragon::getChampsInternal() {
|
|||
}
|
||||
}
|
||||
}
|
||||
Log::info << "loaded " << champs.size() << " champs";
|
||||
Log::info << "loaded " << champs.size() << " champs from cache: " << cacheSuccessfull;
|
||||
lock.unlock();
|
||||
cachedatacv.notify_all();
|
||||
}
|
||||
|
@ -357,6 +360,12 @@ void DataDragon::threadLoop() {
|
|||
|
||||
if(notDownloadedImages.empty() && tasks.empty()) {
|
||||
// everything prefetched, but nothing more to do
|
||||
static bool once = false;
|
||||
if(!once) {
|
||||
once = true;
|
||||
Log::note << "all champs are prefetched now";
|
||||
}
|
||||
|
||||
tasksnotemptycv.wait(lock);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue