diff options
Diffstat (limited to 'common/storage/entitystore.cpp')
-rw-r--r-- | common/storage/entitystore.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/common/storage/entitystore.cpp b/common/storage/entitystore.cpp index 79314ad..f6b8f43 100644 --- a/common/storage/entitystore.cpp +++ b/common/storage/entitystore.cpp | |||
@@ -307,7 +307,7 @@ void EntityStore::cleanupRevision(qint64 revision) | |||
307 | DataStore::setCleanedUpRevision(d->transaction, revision); | 307 | DataStore::setCleanedUpRevision(d->transaction, revision); |
308 | } | 308 | } |
309 | 309 | ||
310 | void EntityStore::cleanupRevisions(qint64 revision) | 310 | bool EntityStore::cleanupRevisions(qint64 revision) |
311 | { | 311 | { |
312 | bool implicitTransaction = false; | 312 | bool implicitTransaction = false; |
313 | if (!d->transaction) { | 313 | if (!d->transaction) { |
@@ -315,13 +315,18 @@ void EntityStore::cleanupRevisions(qint64 revision) | |||
315 | implicitTransaction = true; | 315 | implicitTransaction = true; |
316 | } | 316 | } |
317 | const auto lastCleanRevision = DataStore::cleanedUpRevision(d->transaction); | 317 | const auto lastCleanRevision = DataStore::cleanedUpRevision(d->transaction); |
318 | SinkTrace() << "Cleaning up from " << lastCleanRevision + 1 << " to " << revision; | 318 | const auto firstRevisionToCleanup = lastCleanRevision + 1; |
319 | for (qint64 rev = lastCleanRevision + 1; rev <= revision; rev++) { | 319 | bool cleanupIsNecessary = firstRevisionToCleanup <= revision; |
320 | cleanupRevision(revision); | 320 | if (cleanupIsNecessary) { |
321 | SinkTrace() << "Cleaning up from " << firstRevisionToCleanup << " to " << revision; | ||
322 | for (qint64 rev = firstRevisionToCleanup; rev <= revision; rev++) { | ||
323 | cleanupRevision(revision); | ||
324 | } | ||
321 | } | 325 | } |
322 | if (implicitTransaction) { | 326 | if (implicitTransaction) { |
323 | commitTransaction(); | 327 | commitTransaction(); |
324 | } | 328 | } |
329 | return cleanupIsNecessary; | ||
325 | } | 330 | } |
326 | 331 | ||
327 | QVector<QByteArray> EntityStore::fullScan(const QByteArray &type) | 332 | QVector<QByteArray> EntityStore::fullScan(const QByteArray &type) |