refs #687, further performance improvements

* avoid redundant reads by excluding entities which will be periodically updated
* restart timers when data are received, avoid overlapping requests
This commit is contained in:
Klaus Basan
2016-06-26 00:13:02 +02:00
parent fcba4f2e75
commit 0939b1f08f
7 changed files with 45 additions and 13 deletions

View File

@@ -68,10 +68,11 @@ namespace BlackCore
void CVatsimBookingReader::ps_read()
{
this->threadAssertCheck();
this->restartTimer(true); // when timer active, restart so we cause no undesired reads
Q_ASSERT_X(sApp, Q_FUNC_INFO, "No application");
const QUrl url(sApp->getGlobalSetup().getVatsimBookingsUrl());
if (url.isEmpty()) { return; }
sApp->getFromNetwork(url, { this, &CVatsimBookingReader::ps_parseBookings});
}
@@ -114,10 +115,11 @@ namespace BlackCore
if (this->getUpdateTimestamp() == updateTimestamp) return; // nothing to do
// save parsing and all follow up actions if nothing changed
this->restartTimer(); // do not consider time for reading
bool changed = this->didContentChange(xmlData, xmlData.indexOf("</timestamp>"));
if (!changed)
{
CLogMessage(this).info("Bookings unchanged, skipped");
CLogMessage(this).info("Read bookings unchanged, skipped");
return; // stop, terminate straight away, ending thread
}
}