From b10ca588b7a8a5e3bec22b9e683b4a4dbd5bc889 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 20 Jun 2016 01:12:23 +0200 Subject: Don't create a transaction for every appended message. We create now only one transaction for the whole sync which is also not ideal. --- common/synchronizer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'common/synchronizer.cpp') diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp index ee7a7ba..cf50b0b 100644 --- a/common/synchronizer.cpp +++ b/common/synchronizer.cpp @@ -45,9 +45,10 @@ Synchronizer::~Synchronizer() } -void Synchronizer::setup(const std::function &enqueueCommandCallback) +void Synchronizer::setup(const std::function &enqueueCommandCallback, MessageQueue &mq) { mEnqueue = enqueueCommandCallback; + mMessageQueue = &mq; } void Synchronizer::enqueueCommand(int commandId, const QByteArray &data) @@ -239,9 +240,11 @@ void Synchronizer::modify(const DomainType &entity) KAsync::Job Synchronizer::synchronize() { Trace() << "Synchronizing"; + mMessageQueue->startTransaction(); return synchronizeWithSource().then([this]() { mSyncStore.clear(); mEntityStore.clear(); + mMessageQueue->commit(); }); } -- cgit v1.2.3