Commit 6905a926 authored by Krzysztof Nowicki's avatar Krzysztof Nowicki Committed by Laurent Montel
Browse files

Skip update notifications of own modified items



Record items that have been updated locally and sent to the server so
that when the server notifies us back about their update the
notification can be skipped as the local copy is already in the
correct version.

This prevents redundant item sync requests.

Similar mechanism already exists for item deletion.
Signed-off-by: Krzysztof Nowicki's avatarKrzysztof Nowicki <krissn@op.pl>
parent 26d81458
......@@ -260,6 +260,11 @@ bool EwsFetchItemsJob::processIncrementalRemoteItemUpdates(const EwsItem::List &
emitResult();
return false;
}
const auto qitup = mQueuedUpdates[EwsModifiedEvent].find(id.id());
if (qitup != mQueuedUpdates[EwsModifiedEvent].end() && *qitup == id.changeKey()) {
qCDebugNC(EWSRES_LOG) << QStringLiteral("Match for queued modification of item %1").arg(ewsHash(id.id()));
continue;
}
Item &item = *it;
item.clearPayload();
item.setRemoteRevision(id.changeKey());
......
......@@ -556,6 +556,13 @@ void EwsResource::itemModifyFlagsRequestFinished(KJob *job)
emitReadyStatus();
for (const auto &item : req->items()) {
if (mSubManager) {
mSubManager->queueUpdate(EwsModifiedEvent, item.remoteId(), item.remoteRevision());
}
mQueuedUpdates[item.parentCollection().remoteId()].append({item.remoteId(), item.remoteRevision(), EwsModifiedEvent});
}
qCDebug(EWSRES_AGENTIF_LOG) << "itemsFlagsChanged: done";
changesCommitted(req->items());
}
......@@ -1222,6 +1229,13 @@ void EwsResource::itemsTagChangeFinished(KJob *job)
return;
}
for (const auto &item : updJob->items()) {
if (mSubManager) {
mSubManager->queueUpdate(EwsModifiedEvent, item.remoteId(), item.remoteRevision());
}
mQueuedUpdates[item.parentCollection().remoteId()].append({item.remoteId(), item.remoteRevision(), EwsModifiedEvent});
}
changesCommitted(updJob->items());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment