[Kde-pim] How can I make Akonadi sync events ?

Martin Koller kollix at aon.at
Sun Feb 16 16:53:50 GMT 2014


On Sunday 16 February 2014 13:20:41 Kevin Krammer wrote:
> On Saturday, 2014-02-15, 21:28:03, Martin Koller wrote:
> > On Saturday 15 February 2014 14:04:41 Kevin Krammer wrote:
> > > On Saturday, 2014-02-15, 13:35:10, Martin Koller wrote:
> > > > As my previous mail "akonadi NULL remoteId ... ever set != NULL ?" went
> > > > unanswered, I try to rephrase the question:
> > > > 
> > > > I add an event into my calender (owncloude DAV resource) at a time where
> > > > my
> > > > owncloud server is not reachable (In my case I have e.g. my VPN tunnel
> > > > open).
> > > > 
> > > > When does which part of the Akonadi stack send this event to the
> > > > owncloud
> > > > server or what do I have to do to force it to send this event to the
> > > > server
> > > > ?
> > > 
> > > When you add an item to Akonadi, it will notify the resource that owns the
> > > collection, i.e. the resource gets a call to itemAdded()
> > 
> > Ok, so this would be the DAV groupware resources in this case
> > 
> > > or to its change recorder if offline.
> > 
> > Define "offline", please.
> 
> It is a state the resource can be in.
> Not necessarily meaning offline as in no network connection.
> 
> > In the described case, I'm not completely offline, since I'm connected via
> > VPN over the iternet with my company network. Still, I can not reach the
> > owncloud server in my local network here at home due to the VPN tunnel. Or
> > I had it the other way round: I use the Laptop inside the office network
> > when I'm physically working in the office location and not at home, where
> > I'm also connected to the internet but I have no access to my owncloud
> > server at home.
> > Is this situation "offline" for the DAV resource and will it store it in the
> > change recorded (Note: I have no knowledge yet how the change recorder
> > thingy works or what it is at all)
> 
> Maybe. I think the IMAP resource goes into offline state if it can't reach the 
> server.
> 
> > > The resource then needs to process that add and assign a remoteId.
> > 
> > ok, so this involves contacting the owncloud server, which does not work
> > now. Will this mean, the creation will be put into the change recorder
> > queue and should be retried later ?
> 
> I would expect that, yes.
> 
> > > You seem to have run into a situation where the resource processed the
> > > item
> > > add but did not assign a remote id.
> > 
> > yes, that seems so.
> > I assume this is a bug in the DAV resource then ?
> > checking very briefly the code, DavGroupwareResource::onItemAddedFinished()
> > just does cancelTask() and returns in case of an error. (I do hope that I
> > get an error in this situation)
> 
> Hmm. Maybe cancelTask() is not right here, I could be better to deferTask() 
> and go offline instead. Maybe retrying connect by timer.

That's it!
When I comment out cancelTask() and just do setOnline(false) instead, the next time
I change the resource to online, the new event is sent to the server.
I even do not need to call deferTask().

ok, I try to fix that.

General question:
When akonadi tells the resource to handle an item modification (itemAdded, itemChanged, itemRemoved),
shouldn't the resource NEVER call cancelTask() because if it does, the item in akonadi's DB
is different than in the backend and as you say there is no mechanism which would try to replay
that modification if online, it will never ever be modified in the backend ?
Instead, it should ALWAYS setOnline(false) in case of an error from the backend (or KJob trying to
talk with the backend), so that the next change to online state replays what is in the change queue ?

Even the imap resource does cancelTask() in that case, which I find strange.
E.g. AddItemTask::onAppendMessageDone()
...
  if ( append->error() ) {
    cancelTask( append->errorString() );
    return;
  }

-- 
Best regards/Schöne Grüße

Martin
A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?

()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments

Geschenkideen, Accessoires, Seifen, Kulinarisches: www.bibibest.at
_______________________________________________
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