diff options
Diffstat (limited to 'common/synchronizer.cpp')
-rw-r--r-- | common/synchronizer.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp index f731b31..3cd0cb6 100644 --- a/common/synchronizer.cpp +++ b/common/synchronizer.cpp | |||
@@ -62,7 +62,7 @@ void Synchronizer::enqueueCommand(int commandId, const QByteArray &data) | |||
62 | 62 | ||
63 | Storage::EntityStore &Synchronizer::store() | 63 | Storage::EntityStore &Synchronizer::store() |
64 | { | 64 | { |
65 | mEntityStore->startTransaction(Sink::Storage::DataStore::ReadOnly); | 65 | Q_ASSERT(mEntityStore->hasTransaction()); |
66 | return *mEntityStore; | 66 | return *mEntityStore; |
67 | } | 67 | } |
68 | 68 | ||
@@ -385,11 +385,13 @@ KAsync::Job<void> Synchronizer::processSyncQueue() | |||
385 | const auto request = mSyncRequestQueue.takeFirst(); | 385 | const auto request = mSyncRequestQueue.takeFirst(); |
386 | return KAsync::syncStart<void>([this] { | 386 | return KAsync::syncStart<void>([this] { |
387 | mMessageQueue->startTransaction(); | 387 | mMessageQueue->startTransaction(); |
388 | mEntityStore->startTransaction(Sink::Storage::DataStore::ReadOnly); | ||
388 | mSyncInProgress = true; | 389 | mSyncInProgress = true; |
389 | }) | 390 | }) |
390 | .then(processRequest(request)) | 391 | .then(processRequest(request)) |
391 | .then<void>([this](const KAsync::Error &error) { | 392 | .then<void>([this](const KAsync::Error &error) { |
392 | SinkTraceCtx(mLogCtx) << "Sync request processed"; | 393 | SinkTraceCtx(mLogCtx) << "Sync request processed"; |
394 | mEntityStore->abortTransaction(); | ||
393 | mSyncTransaction.abort(); | 395 | mSyncTransaction.abort(); |
394 | mMessageQueue->commit(); | 396 | mMessageQueue->commit(); |
395 | mSyncStore.clear(); | 397 | mSyncStore.clear(); |
@@ -409,7 +411,6 @@ KAsync::Job<void> Synchronizer::processSyncQueue() | |||
409 | void Synchronizer::commit() | 411 | void Synchronizer::commit() |
410 | { | 412 | { |
411 | mMessageQueue->commit(); | 413 | mMessageQueue->commit(); |
412 | mEntityStore->abortTransaction(); | ||
413 | mSyncTransaction.commit(); | 414 | mSyncTransaction.commit(); |
414 | mSyncStore.clear(); | 415 | mSyncStore.clear(); |
415 | if (mSyncInProgress) { | 416 | if (mSyncInProgress) { |
@@ -472,7 +473,8 @@ KAsync::Job<void> Synchronizer::replay(const QByteArray &type, const QByteArray | |||
472 | Q_ASSERT(metadataBuffer); | 473 | Q_ASSERT(metadataBuffer); |
473 | Q_ASSERT(!mSyncStore); | 474 | Q_ASSERT(!mSyncStore); |
474 | Q_ASSERT(!mSyncTransaction); | 475 | Q_ASSERT(!mSyncTransaction); |
475 | mEntityStore->startTransaction(Storage::DataStore::ReadOnly); | 476 | //The entitystore transaction is handled by processSyncQueue |
477 | Q_ASSERT(mEntityStore->hasTransaction()); | ||
476 | 478 | ||
477 | const auto operation = metadataBuffer ? metadataBuffer->operation() : Sink::Operation_Creation; | 479 | const auto operation = metadataBuffer ? metadataBuffer->operation() : Sink::Operation_Creation; |
478 | const auto uid = Sink::Storage::DataStore::uidFromKey(key); | 480 | const auto uid = Sink::Storage::DataStore::uidFromKey(key); |
@@ -525,7 +527,6 @@ KAsync::Job<void> Synchronizer::replay(const QByteArray &type, const QByteArray | |||
525 | } | 527 | } |
526 | mSyncStore.clear(); | 528 | mSyncStore.clear(); |
527 | mSyncTransaction.commit(); | 529 | mSyncTransaction.commit(); |
528 | mEntityStore->abortTransaction(); | ||
529 | }); | 530 | }); |
530 | } | 531 | } |
531 | 532 | ||