diff options
-rw-r--r-- | common/synchronizer.cpp | 13 | ||||
-rw-r--r-- | examples/imapresource/imapresource.cpp | 5 |
2 files changed, 15 insertions, 3 deletions
diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp index 51e53c8..037a01f 100644 --- a/common/synchronizer.cpp +++ b/common/synchronizer.cpp | |||
@@ -626,6 +626,19 @@ KAsync::Job<void> Synchronizer::replay(const QByteArray &type, const QByteArray | |||
626 | } | 626 | } |
627 | SinkLogCtx(mLogCtx) << "Replaying: " << key << "Type: " << type << "Uid: " << uid << "Rid: " << oldRemoteId << "Revision: " << metadataBuffer->revision(); | 627 | SinkLogCtx(mLogCtx) << "Replaying: " << key << "Type: " << type << "Uid: " << uid << "Rid: " << oldRemoteId << "Revision: " << metadataBuffer->revision(); |
628 | 628 | ||
629 | //If the entity has been removed already and this is not the removal, skip over. | ||
630 | //This is important so we can unblock changereplay by removing entities. | ||
631 | bool skipOver = false; | ||
632 | store().readLatest(type, uid, [&](const ApplicationDomain::ApplicationDomainType &, Sink::Operation latestOperation) { | ||
633 | if (latestOperation == Sink::Operation_Removal && operation != Sink::Operation_Removal) { | ||
634 | skipOver = true; | ||
635 | } | ||
636 | }); | ||
637 | if (skipOver) { | ||
638 | SinkLogCtx(mLogCtx) << "Skipping over already removed entity"; | ||
639 | return KAsync::null(); | ||
640 | } | ||
641 | |||
629 | KAsync::Job<QByteArray> job = KAsync::null<QByteArray>(); | 642 | KAsync::Job<QByteArray> job = KAsync::null<QByteArray>(); |
630 | //TODO This requires supporting every domain type here as well. Can we solve this better so we can do the dispatch somewhere centrally? | 643 | //TODO This requires supporting every domain type here as well. Can we solve this better so we can do the dispatch somewhere centrally? |
631 | if (type == ApplicationDomain::getTypeName<ApplicationDomain::Folder>()) { | 644 | if (type == ApplicationDomain::getTypeName<ApplicationDomain::Folder>()) { |
diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp index 0527902..4151afa 100644 --- a/examples/imapresource/imapresource.cpp +++ b/examples/imapresource/imapresource.cpp | |||
@@ -691,10 +691,9 @@ public: | |||
691 | { | 691 | { |
692 | if (operation != Sink::Operation_Creation) { | 692 | if (operation != Sink::Operation_Creation) { |
693 | if(oldRemoteId.isEmpty()) { | 693 | if(oldRemoteId.isEmpty()) { |
694 | // return KAsync::error<QByteArray>("Tried to replay modification without old remoteId."); | 694 | SinkWarning() << "Tried to replay modification without old remoteId."; |
695 | qWarning() << "Tried to replay modification without old remoteId."; | ||
696 | // Since we can't recover from the situation we just skip over the revision. | 695 | // Since we can't recover from the situation we just skip over the revision. |
697 | // FIXME figure out how we can ever end up in this situation | 696 | // This can for instance happen if creation failed, and we then process a removal or modification. |
698 | return KAsync::null<QByteArray>(); | 697 | return KAsync::null<QByteArray>(); |
699 | } | 698 | } |
700 | } | 699 | } |