Ref T367, do not read again when info/setup was just read (age)

This commit is contained in:
Klaus Basan
2018-09-22 00:25:31 +02:00
parent fd1001862f
commit 7ae7d04548
2 changed files with 22 additions and 1 deletions

View File

@@ -221,6 +221,14 @@ namespace BlackCore
return msgs;
}
if (m_setup.lastUpdatedAge() < 5000)
{
const CStatusMessage m(this, CStatusMessage::SeverityInfo, "Update info just updated, skip read");
CStatusMessageList msgs(m);
this->setLastSetupReadErrorMessages(msgs);
return msgs;
}
// trigger two reads, the file size is small
const CUrlList randomUrls = m_bootstrapUrls.randomElements(2);
CUrl url = randomUrls.front();
@@ -252,11 +260,17 @@ namespace BlackCore
const CUrlList randomUrls = m_updateInfoUrls.randomElements(2);
if (randomUrls.isEmpty())
{
CStatusMessage(this).warning("Cannot read update info, no URLs");
CLogMessage(this).warning("Cannot read update info, no URLs");
this->manageUpdateInfoAvailability(false);
return;
}
if (m_updateInfo.lastUpdatedAge() < 5000)
{
CLogMessage(this).info("Update info just updated, skip read");
return;
}
if (!sApp || m_shutdown) { return; }
CUrl url = randomUrls.front();
const CStatusMessage m1(this, CStatusMessage::SeverityInfo, "Start reading update info 1st URL: " + url.toQString());