DB reader, doWorkCheck before writing cache. In case shutdown takes place in-between.

This commit is contained in:
Klaus Basan
2018-04-04 00:04:04 +02:00
parent 57b3760b61
commit 7d106acdee
4 changed files with 10 additions and 3 deletions

View File

@@ -301,6 +301,7 @@ namespace BlackCore
liveries = CLiveryList::fromDatabaseJson(res);
}
if (!this->doWorkCheck()) { return; }
const int n = liveries.size();
qint64 latestTimestamp = liveries.latestTimestampMsecsSinceEpoch();
if (n > 0 && latestTimestamp < 0)
@@ -343,6 +344,7 @@ namespace BlackCore
distributors = CDistributorList::fromDatabaseJson(res);
}
if (!this->doWorkCheck()) { return; }
const int n = distributors.size();
qint64 latestTimestamp = distributors.latestTimestampMsecsSinceEpoch();
if (n > 0 && latestTimestamp < 0)
@@ -386,6 +388,7 @@ namespace BlackCore
}
// synchronized update
if (!this->doWorkCheck()) { return; }
const int n = models.size();
qint64 latestTimestamp = models.latestTimestampMsecsSinceEpoch();
if (n > 0 && latestTimestamp < 0)