diff options
-rw-r--r-- | common/genericresource.cpp | 6 | ||||
-rw-r--r-- | common/genericresource.h | 2 | ||||
-rw-r--r-- | examples/dummyresource/resourcefactory.cpp | 2 | ||||
-rw-r--r-- | examples/dummyresource/resourcefactory.h | 2 | ||||
-rw-r--r-- | examples/maildirresource/maildirresource.cpp | 6 | ||||
-rw-r--r-- | examples/maildirresource/maildirresource.h | 2 |
6 files changed, 10 insertions, 10 deletions
diff --git a/common/genericresource.cpp b/common/genericresource.cpp index 42153ec..29acce4 100644 --- a/common/genericresource.cpp +++ b/common/genericresource.cpp | |||
@@ -282,7 +282,9 @@ GenericResource::GenericResource(const QByteArray &resourceInstanceIdentifier, c | |||
282 | QObject::connect(mProcessor, &CommandProcessor::error, [this](int errorCode, const QString &msg) { onProcessorError(errorCode, msg); }); | 282 | QObject::connect(mProcessor, &CommandProcessor::error, [this](int errorCode, const QString &msg) { onProcessorError(errorCode, msg); }); |
283 | QObject::connect(mPipeline.data(), &Pipeline::revisionUpdated, this, &Resource::revisionUpdated); | 283 | QObject::connect(mPipeline.data(), &Pipeline::revisionUpdated, this, &Resource::revisionUpdated); |
284 | mSourceChangeReplay = new ChangeReplay(resourceInstanceIdentifier, [this](const QByteArray &type, const QByteArray &key, const QByteArray &value) { | 284 | mSourceChangeReplay = new ChangeReplay(resourceInstanceIdentifier, [this](const QByteArray &type, const QByteArray &key, const QByteArray &value) { |
285 | return this->replay(type, key, value); | 285 | //This results in a deadlock when a sync is in progress and we try to create a second writing transaction (which is why we turn changereplay off during the sync) |
286 | auto synchronizationStore = QSharedPointer<Akonadi2::Storage>::create(Akonadi2::storageLocation(), mResourceInstanceIdentifier + ".synchronization", Akonadi2::Storage::ReadWrite); | ||
287 | return this->replay(*synchronizationStore, type, key, value).then<void>([synchronizationStore](){}); | ||
286 | }); | 288 | }); |
287 | enableChangeReplay(true); | 289 | enableChangeReplay(true); |
288 | mClientLowerBoundRevision = mPipeline->cleanedUpRevision(); | 290 | mClientLowerBoundRevision = mPipeline->cleanedUpRevision(); |
@@ -317,7 +319,7 @@ void GenericResource::addType(const QByteArray &type, DomainTypeAdaptorFactoryIn | |||
317 | mPipeline->setAdaptorFactory(type, factory); | 319 | mPipeline->setAdaptorFactory(type, factory); |
318 | } | 320 | } |
319 | 321 | ||
320 | KAsync::Job<void> GenericResource::replay(const QByteArray &type, const QByteArray &key, const QByteArray &value) | 322 | KAsync::Job<void> GenericResource::replay(Akonadi2::Storage &synchronizationStore, const QByteArray &type, const QByteArray &key, const QByteArray &value) |
321 | { | 323 | { |
322 | return KAsync::null<void>(); | 324 | return KAsync::null<void>(); |
323 | } | 325 | } |
diff --git a/common/genericresource.h b/common/genericresource.h index c12c631..f47c6f8 100644 --- a/common/genericresource.h +++ b/common/genericresource.h | |||
@@ -60,7 +60,7 @@ private Q_SLOTS: | |||
60 | protected: | 60 | protected: |
61 | void enableChangeReplay(bool); | 61 | void enableChangeReplay(bool); |
62 | void addType(const QByteArray &type, DomainTypeAdaptorFactoryInterface::Ptr factory, const QVector<Akonadi2::Preprocessor*> &preprocessors); | 62 | void addType(const QByteArray &type, DomainTypeAdaptorFactoryInterface::Ptr factory, const QVector<Akonadi2::Preprocessor*> &preprocessors); |
63 | virtual KAsync::Job<void> replay(const QByteArray &type, const QByteArray &key, const QByteArray &value); | 63 | virtual KAsync::Job<void> replay(Akonadi2::Storage &synchronizationStore, const QByteArray &type, const QByteArray &key, const QByteArray &value); |
64 | void onProcessorError(int errorCode, const QString &errorMessage); | 64 | void onProcessorError(int errorCode, const QString &errorMessage); |
65 | void enqueueCommand(MessageQueue &mq, int commandId, const QByteArray &data); | 65 | void enqueueCommand(MessageQueue &mq, int commandId, const QByteArray &data); |
66 | 66 | ||
diff --git a/examples/dummyresource/resourcefactory.cpp b/examples/dummyresource/resourcefactory.cpp index a24ff27..08e3594 100644 --- a/examples/dummyresource/resourcefactory.cpp +++ b/examples/dummyresource/resourcefactory.cpp | |||
@@ -164,7 +164,7 @@ KAsync::Job<void> DummyResource::synchronizeWithSource() | |||
164 | }); | 164 | }); |
165 | } | 165 | } |
166 | 166 | ||
167 | KAsync::Job<void> DummyResource::replay(const QByteArray &type, const QByteArray &key, const QByteArray &value) | 167 | KAsync::Job<void> DummyResource::replay(Akonadi2::Storage &synchronizationStore, const QByteArray &type, const QByteArray &key, const QByteArray &value) |
168 | { | 168 | { |
169 | Trace() << "Replaying " << key; | 169 | Trace() << "Replaying " << key; |
170 | return KAsync::null<void>(); | 170 | return KAsync::null<void>(); |
diff --git a/examples/dummyresource/resourcefactory.h b/examples/dummyresource/resourcefactory.h index 3216e13..c638b7c 100644 --- a/examples/dummyresource/resourcefactory.h +++ b/examples/dummyresource/resourcefactory.h | |||
@@ -40,7 +40,7 @@ public: | |||
40 | KAsync::Job<void> synchronizeWithSource() Q_DECL_OVERRIDE; | 40 | KAsync::Job<void> synchronizeWithSource() Q_DECL_OVERRIDE; |
41 | static void removeFromDisk(const QByteArray &instanceIdentifier); | 41 | static void removeFromDisk(const QByteArray &instanceIdentifier); |
42 | private: | 42 | private: |
43 | KAsync::Job<void> replay(const QByteArray &type, const QByteArray &key, const QByteArray &value) Q_DECL_OVERRIDE; | 43 | KAsync::Job<void> replay(Akonadi2::Storage &synchronizationStore, const QByteArray &type, const QByteArray &key, const QByteArray &value) Q_DECL_OVERRIDE; |
44 | QString resolveRemoteId(const QByteArray &type, const QString &remoteId, Akonadi2::Storage::Transaction &transaction); | 44 | QString resolveRemoteId(const QByteArray &type, const QString &remoteId, Akonadi2::Storage::Transaction &transaction); |
45 | void createEvent(const QByteArray &rid, const QMap<QString, QVariant> &data, flatbuffers::FlatBufferBuilder &entityFbb, Akonadi2::Storage::Transaction &); | 45 | void createEvent(const QByteArray &rid, const QMap<QString, QVariant> &data, flatbuffers::FlatBufferBuilder &entityFbb, Akonadi2::Storage::Transaction &); |
46 | void createMail(const QByteArray &rid, const QMap<QString, QVariant> &data, flatbuffers::FlatBufferBuilder &entityFbb, Akonadi2::Storage::Transaction &); | 46 | void createMail(const QByteArray &rid, const QMap<QString, QVariant> &data, flatbuffers::FlatBufferBuilder &entityFbb, Akonadi2::Storage::Transaction &); |
diff --git a/examples/maildirresource/maildirresource.cpp b/examples/maildirresource/maildirresource.cpp index 273b996..b49a27e 100644 --- a/examples/maildirresource/maildirresource.cpp +++ b/examples/maildirresource/maildirresource.cpp | |||
@@ -212,11 +212,9 @@ KAsync::Job<void> MaildirResource::synchronizeWithSource(Akonadi2::Storage &main | |||
212 | }); | 212 | }); |
213 | } | 213 | } |
214 | 214 | ||
215 | KAsync::Job<void> MaildirResource::replay(const QByteArray &type, const QByteArray &key, const QByteArray &value) | 215 | KAsync::Job<void> MaildirResource::replay(Akonadi2::Storage &synchronizationStore, const QByteArray &type, const QByteArray &key, const QByteArray &value) |
216 | { | 216 | { |
217 | //This results in a deadlock during sync | 217 | auto synchronizationTransaction = synchronizationStore.createTransaction(Akonadi2::Storage::ReadWrite); |
218 | Akonadi2::Storage store(Akonadi2::storageLocation(), mResourceInstanceIdentifier + ".synchronization", Akonadi2::Storage::ReadWrite); | ||
219 | auto synchronizationTransaction = store.createTransaction(Akonadi2::Storage::ReadWrite); | ||
220 | 218 | ||
221 | Trace() << "Replaying " << key << type; | 219 | Trace() << "Replaying " << key << type; |
222 | if (type == ENTITY_TYPE_FOLDER) { | 220 | if (type == ENTITY_TYPE_FOLDER) { |
diff --git a/examples/maildirresource/maildirresource.h b/examples/maildirresource/maildirresource.h index 48eac67..389b7f4 100644 --- a/examples/maildirresource/maildirresource.h +++ b/examples/maildirresource/maildirresource.h | |||
@@ -38,7 +38,7 @@ public: | |||
38 | KAsync::Job<void> synchronizeWithSource(Akonadi2::Storage &mainStore, Akonadi2::Storage &synchronizationStore) Q_DECL_OVERRIDE; | 38 | KAsync::Job<void> synchronizeWithSource(Akonadi2::Storage &mainStore, Akonadi2::Storage &synchronizationStore) Q_DECL_OVERRIDE; |
39 | static void removeFromDisk(const QByteArray &instanceIdentifier); | 39 | static void removeFromDisk(const QByteArray &instanceIdentifier); |
40 | private: | 40 | private: |
41 | KAsync::Job<void> replay(const QByteArray &type, const QByteArray &key, const QByteArray &value) Q_DECL_OVERRIDE; | 41 | KAsync::Job<void> replay(Akonadi2::Storage &synchronizationStore, const QByteArray &type, const QByteArray &key, const QByteArray &value) Q_DECL_OVERRIDE; |
42 | 42 | ||
43 | void synchronizeFolders(Akonadi2::Storage::Transaction &transaction, Akonadi2::Storage::Transaction &synchronizationTransaction); | 43 | void synchronizeFolders(Akonadi2::Storage::Transaction &transaction, Akonadi2::Storage::Transaction &synchronizationTransaction); |
44 | void synchronizeMails(Akonadi2::Storage::Transaction &transaction, Akonadi2::Storage::Transaction &synchronizationTransaction, const QString &folder); | 44 | void synchronizeMails(Akonadi2::Storage::Transaction &transaction, Akonadi2::Storage::Transaction &synchronizationTransaction, const QString &folder); |