diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-06-20 01:12:23 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-06-20 01:12:23 +0200 |
commit | b10ca588b7a8a5e3bec22b9e683b4a4dbd5bc889 (patch) | |
tree | d9dffc7c8ef7caac35934fc38c410281911ac265 /common/synchronizer.cpp | |
parent | ea4d0708e63b7dc7ee0b1cb150f1e09da1f52046 (diff) | |
download | sink-b10ca588b7a8a5e3bec22b9e683b4a4dbd5bc889.tar.gz sink-b10ca588b7a8a5e3bec22b9e683b4a4dbd5bc889.zip |
Don't create a transaction for every appended message.
We create now only one transaction for the whole sync which is also not
ideal.
Diffstat (limited to 'common/synchronizer.cpp')
-rw-r--r-- | common/synchronizer.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
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() | |||
45 | 45 | ||
46 | } | 46 | } |
47 | 47 | ||
48 | void Synchronizer::setup(const std::function<void(int commandId, const QByteArray &data)> &enqueueCommandCallback) | 48 | void Synchronizer::setup(const std::function<void(int commandId, const QByteArray &data)> &enqueueCommandCallback, MessageQueue &mq) |
49 | { | 49 | { |
50 | mEnqueue = enqueueCommandCallback; | 50 | mEnqueue = enqueueCommandCallback; |
51 | mMessageQueue = &mq; | ||
51 | } | 52 | } |
52 | 53 | ||
53 | void Synchronizer::enqueueCommand(int commandId, const QByteArray &data) | 54 | void Synchronizer::enqueueCommand(int commandId, const QByteArray &data) |
@@ -239,9 +240,11 @@ void Synchronizer::modify(const DomainType &entity) | |||
239 | KAsync::Job<void> Synchronizer::synchronize() | 240 | KAsync::Job<void> Synchronizer::synchronize() |
240 | { | 241 | { |
241 | Trace() << "Synchronizing"; | 242 | Trace() << "Synchronizing"; |
243 | mMessageQueue->startTransaction(); | ||
242 | return synchronizeWithSource().then<void>([this]() { | 244 | return synchronizeWithSource().then<void>([this]() { |
243 | mSyncStore.clear(); | 245 | mSyncStore.clear(); |
244 | mEntityStore.clear(); | 246 | mEntityStore.clear(); |
247 | mMessageQueue->commit(); | ||
245 | }); | 248 | }); |
246 | } | 249 | } |
247 | 250 | ||