[Kde-pim] Re: Bug? CollectionFetchJob doesn't always work after AgentInstanceCreateJob

Kevin Krammer kevin.krammer at gmx.at
Sun May 15 20:53:55 BST 2011


On Sunday, 2011-05-15, David Jarvie wrote:

> void CalendarCreator::agentCreated(KJob* j)
> {
>     if (j->error())
>     {
>         kError() << "AgentInstanceCreateJob error";
>         return;
>     }
> 
>     // Configure the Akonadi Agent
>     kDebug() << mName;
>     AgentInstanceCreateJob* job = static_cast<AgentInstanceCreateJob*>(j);
>     mAgent = job->instance();
>     ...
>     mAgent.setName(mName);
>     mAgent.reconfigure();   // notify the agent that its configuration has
> been changed
> 
>     // Find the collection which this agent manages
>     CollectionFetchJob* fjob = new CollectionFetchJob(Collection::root(),
> CollectionFetchJob::FirstLevel);
> fjob->fetchScope().setResource(mAgent.identifier());
>     connect(fjob, SIGNAL(collectionsReceived(const
> Akonadi::Collection::List&)), SLOT(collectionsReceived(const
> Akonadi::Collection::List&))); connect(fjob, SIGNAL(result(KJob*)),
> SLOT(collectionFetchResult(KJob*))); }

AgentInstance:reconfigure() is a D-Bus call from one process into another so 
there is always some level of concurrency.

Most resources react to the reconfigure call by checking their current config 
and when it makes sense requesting a synchronization of their collection tree.
Which involves yet another process (Akonadi server) and is delayed (as in 
event loop processing continues right away).

So it is a matter of timing if the resource has had time to receive its 
retrieveCollections call and answer it.
A CollectionFetchJob can therefore see any number of collections on that 
resource, e.g. 0 if the call hasn't been processed yet, more but not all if 
the retrieval is streamed but has not yet finished, or all.

Cheers,
Kevin

-- 
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20110515/2614cc28/attachment.sig>
-------------- next part --------------
_______________________________________________
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