[Kde-pim] ItemFetchJob - Only fetching items which have a payload

Christian Mollekopf chrigi_1 at fastmail.fm
Fri May 24 12:24:03 BST 2013


On Thursday 23 May 2013 23.49:00 Vishesh Handa wrote:
> Hey guys
> 
> In the Akonadi Nepomuk Feeder we have this ItemFetchJob which fetches all
> the items in a collection, and then sends them for indexing if they aren't
> already indexed.
> 
> The problem is that many of these items often do not have a payload, so
> when we try to fetch the payload in order to index its contents, the fetch
> fails. This skews the progress and results in the akonadi feeder attempting
> to fetch a large number of payload-less items on startup.
> 
> Is there any way to only fetch the items which have a payload in a cache,
> but not fetch the actual payload?
> 
> The relevant code is
> kdepim-runtime/agents/nepomukfeeder/findunindexeditemsjob.cpp
> 
>     const Akonadi::Collection col = mIndexedCollections.takeLast();
>     Akonadi::ItemFetchJob *fetchJob = new Akonadi::ItemFetchJob(col, this);
>     fetchJob->fetchScope().fetchAllAttributes(false);
>     fetchJob->fetchScope().fetchFullPayload(false);
>     fetchJob->fetchScope().setFetchModificationTime(true);
>     connect(fetchJob, SIGNAL(itemsReceived(Akonadi::Item::List)), this,
> SLOT(itemsReceived(Akonadi::Item::List)));
>     connect(fetchJob, SIGNAL(result(KJob*)), this, SLOT(jobDone(KJob*)));

Hey Vishesh,

AFAIK there is currently no way to list items which have a payload without 
actually fetching it.

In either case you should probably have:

job->fetchScope().setCacheOnly( true );                                                                                                                                  
job->fetchScope().setIgnoreRetrievalErrors( true );

* cache only means  the fetch job will not trigger the backend resource (i.e. 
imap), if the item is not already in the cache. Otherwise this can lead to the 
resource starting to download all your mail.
* ignore retrieval errors: by default, if a single item fails to be fetched 
(i.e. because it's parts are not in the cache), the whole fetch command fails 
and delivers no results. With this option the fetch job ignores errors and 
simply fetches what is available.

I don't have a solution for the other problem though.
It would either need another extension of the ItemFetchScope(): e.g. 
listOnlyFullyAvailableItems()
Or it could be added to the collection statistics maybe.

Cheers,
Christian




_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list