QuotaInfo: make sure that we always check the quota every 30 seconds

This commit is contained in:
Olivier Goffart 2015-06-26 18:04:27 +02:00
parent 236951d9b3
commit 51c10de672

View file

@ -50,11 +50,11 @@ void QuotaInfo::setActive(bool active)
void QuotaInfo::slotAccountStateChanged()
{
if (canGetQuota()) {
if (_lastQuotaRecieved.isNull()
|| _lastQuotaRecieved.msecsTo(QDateTime::currentDateTime()) > defaultIntervalT) {
auto elapsed = _lastQuotaRecieved.msecsTo(QDateTime::currentDateTime());
if (_lastQuotaRecieved.isNull() || elapsed >= defaultIntervalT) {
slotCheckQuota();
} else {
_jobRestartTimer.start(defaultIntervalT);
_jobRestartTimer.start(defaultIntervalT - elapsed);
}
} else {
_jobRestartTimer.stop();