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

Do not retrieve unchanged items during full sync



When doing an incremental sync using the SyncFolderItems request all
items appearing as new or changed have actually changed and it makes
sense to fetch them in order to store the updated copy locally.

When doing a full sync this way all items in this foler appear as
newly added to it. This however meant that they were all fetched,
which was lengthly and completely redundant.

To avoid unnecessary fetches compare the change key of the item and
fetch only in case it's different than the local copy. This avoids 99%
of the fetches in case of a full sync (most of them are fallback full
syncs due to incremental sync failures) and additionally saves a few
fetches for incremental syncs too in cases where such a sync is done
due to a returning server notification for a change that originated
from the local Akonadi instance.
Signed-off-by: Krzysztof Nowicki's avatarKrzysztof Nowicki <krissn@op.pl>
parent 3046b7d8
/*
SPDX-FileCopyrightText: 2015-2016 Krzysztof Nowicki <krissn@op.pl>
SPDX-FileCopyrightText: 2015-2019 Krzysztof Nowicki <krissn@op.pl>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
......@@ -318,15 +318,21 @@ void EwsFetchItemsJob::compareItemLists()
++mTotalItemsToFetch;
} else {
Item &item = *it;
item.clearPayload();
item.setRemoteRevision(id.changeKey());
if (!mTagStore->readEwsProperties(item, ewsItem, mTagsSynced)) {
qCDebugNC(EWSRES_LOG) << QStringLiteral("Missing tags encountered - forcing sync");
syncTags();
return;
/* In case of a full sync even unchanged items appear as new. Compare the change keys
* to determine if a fetch is needed. */
if (item.remoteRevision() != id.changeKey()) {
item.clearPayload();
item.setRemoteRevision(id.changeKey());
if (!mTagStore->readEwsProperties(item, ewsItem, mTagsSynced)) {
qCDebugNC(EWSRES_LOG) << QStringLiteral("Missing tags encountered - forcing sync");
syncTags();
return;
}
toFetchItems[type].append(item);
++mTotalItemsToFetch;
} else {
qCDebugNC(EWSRES_LOG) << QStringLiteral("Matching change key for item %1 - not syncing").arg(ewsHash(id.id()));
}
toFetchItems[type].append(item);
++mTotalItemsToFetch;
itemHash.erase(it);
}
}
......
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