Commit 0c0c2824 authored by Martin Koller's avatar Martin Koller

don't CreateItem when it is already in the DB. Use ModifyItem instead.

To avoid running into the "multiple merge candiate" problem when
akonadi searches items by RID and for whatever reason there are
really duplicate RIDs, instead when we already have an item ID from
the DB, avoid using a Create job at all and answer a fetch with
a Modify Job. Akonadi will then query this item by the given id,
which is unique and we can never get multiple items in return.
Also a query by id is faster since it's indexed.

Differential Revision:
parent ad5a5a3f
......@@ -1330,7 +1330,9 @@ void ResourceBase::itemsRetrieved(const Item::List &items)
this, SLOT(slotItemSyncDone(KJob*)));
for (const Item &item : items) {
if (!item.remoteId().isEmpty()) {
if (item.isValid()) {
new ItemModifyJob(item, trx);
} else if (!item.remoteId().isEmpty()) {
auto job = new ItemCreateJob(item, item.parentCollection(), trx);
} else {
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