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

@@ -98,6 +98,15 @@ namespace BlackCore
});
}
void CThreadedReader::restartTimer(bool onlyWhenActive)
{
const int intervalMs(this->interval());
if (!onlyWhenActive || this->isTimerActive())
{
this->setInterval(intervalMs);
}
}
bool CThreadedReader::didContentChange(const QString &content, int startPosition)
{
uint oldHash = 0;
@@ -126,6 +135,12 @@ namespace BlackCore
return this->m_updateTimer->interval();
}
bool CThreadedReader::isTimerActive() const
{
QReadLocker rl(&this->m_lock);
return this->m_updateTimer->isActive();
}
void CThreadedReader::setIntervalFromSettingsAndStart()
{
this->setInitialTime();