mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
This commit is contained in:
committed by
Mathew Sutcliffe
parent
4804d81857
commit
a9fc21af2f
@@ -145,38 +145,43 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CGlobalSetup gs;
|
QString type(urlString.toLower().contains("develop") ? "DEV" : "PRODUCTIVE");
|
||||||
gs.convertFromJson(Json::jsonObjectFromString(setupJson));
|
CGlobalSetup currentSetup(m_setup.get());
|
||||||
if (gs.getMSecsSinceEpoch() == 0 && lastModified > 0) { gs.setMSecsSinceEpoch(lastModified); }
|
CGlobalSetup loadedSetup;
|
||||||
qint64 currentVersionTimestamp = m_setup.get().getMSecsSinceEpoch();
|
loadedSetup.convertFromJson(Json::jsonObjectFromString(setupJson));
|
||||||
qint64 newVersionTimestamp = gs.getMSecsSinceEpoch();
|
loadedSetup.setType(type);
|
||||||
bool newVersionLoaded = (newVersionTimestamp - currentVersionTimestamp) > 0;
|
if (loadedSetup.getMSecsSinceEpoch() == 0 && lastModified > 0) { loadedSetup.setMSecsSinceEpoch(lastModified); }
|
||||||
bool sameVersionLoaded = newVersionTimestamp == currentVersionTimestamp;
|
bool sameType = loadedSetup.hasSameType(currentSetup.getType());
|
||||||
|
qint64 currentVersionTimestamp = currentSetup.getMSecsSinceEpoch();
|
||||||
|
qint64 newVersionTimestamp = loadedSetup.getMSecsSinceEpoch();
|
||||||
|
bool sameVersionLoaded = sameType && (newVersionTimestamp == currentVersionTimestamp);
|
||||||
if (sameVersionLoaded)
|
if (sameVersionLoaded)
|
||||||
{
|
{
|
||||||
CLogMessage(this).info("Same version loaded from %1 as already in data cache %2") << urlString << CDataCache::persistentStore();
|
CLogMessage(this).info("Same version loaded from %1 as already in data cache %2") << urlString << CDataCache::persistentStore();
|
||||||
return; // success
|
return; // success
|
||||||
}
|
}
|
||||||
|
|
||||||
CStatusMessage m = m_setup.set(gs);
|
bool outdatedVersionLoaded = sameType && (newVersionTimestamp < currentVersionTimestamp);
|
||||||
if (!m.isEmpty())
|
if (outdatedVersionLoaded)
|
||||||
{
|
{
|
||||||
CLogMessage(this).preformatted(m);
|
CLogMessage(this).info("Version loaded from %1 outdated, older than version in data cache %2") << urlString << CDataCache::persistentStore();
|
||||||
return; // issue with cache
|
// try next URL
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (newVersionLoaded)
|
CStatusMessage m = m_setup.set(loadedSetup);
|
||||||
|
if (!m.isEmpty())
|
||||||
{
|
{
|
||||||
CLogMessage(this).info("Updated data cache in %1") << CDataCache::persistentStore();
|
CLogMessage(this).preformatted(m);
|
||||||
return; // success
|
return; // issue with cache
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CLogMessage(this).warning("Local bootstrap file in %1 newer than URL %2") << CDataCache::persistentStore() << urlString;
|
CLogMessage(this).info("Updated data cache in %1") << CDataCache::persistentStore();
|
||||||
// try next URL
|
return; // success
|
||||||
}
|
} // cache
|
||||||
} // cache
|
} // outdated?
|
||||||
|
|
||||||
} // json empty
|
} // json empty
|
||||||
} // no error
|
} // no error
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user