Bug 308122

Summary: After some weeks downtime, google calendar fetch fails. "The requested minimum modification time lies too far in the past"
Product: [Frameworks and Libraries] Akonadi Reporter: Andreas K. Huettel <dilfridge>
Component: Google ResourceAssignee: Daniel Vrátil <dvratil>
Status: RESOLVED FIXED    
Severity: normal CC: GeoBaltz, kdepim-bugs, Mathias.Homann, mfraz74+kde
Priority: NOR    
Version: 4.9   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 4.10.4
Sentry Crash Report:

Description Andreas K. Huettel 2012-10-09 12:46:46 UTC
Gentoo Linux, KDE 4.9.2 with libkgapi-0.4.2

After ~3 weeks downtime, google calendar fetch fails on every login with an error message: 

Resource does not exist anymore. Google replied: "The requested minimum modification time lies too far in the past"

Please tell me if you need any additional info...
Comment 1 Mathias Homann 2013-01-01 10:11:32 UTC
I'm having the very same thing, whenever I use an account on my laptop that I only use once every few weeks.
Comment 2 Daniel Vrátil 2013-01-08 10:58:15 UTC
Confirmed, Calendar API allows to fetch only items changed within approximately last 25 days. When trying to request list of changes from deeper in the history, the API will return this error.

Solution is probably to use timeMin argument when last update was more then 20 (?) days ago and fetch all events with dtStart>=timeMin. Using lastUpdated date, we can filter out events that were not changed between timeMin and now and use itemsRetrievedIncremental().
Comment 3 George Baltz 2013-05-09 15:38:09 UTC
Having the same problem(KDE SC 4.10.2, openSUSE 12.3) - is there any workaround to get the calendar updated on this laptop, or do I have to delete the resource and start over?
Comment 4 Daniel Vrátil 2013-05-14 12:23:06 UTC
Sorry, not yet. You have to remove and add the resource again.
Comment 5 Daniel Vrátil 2013-05-14 14:08:19 UTC
Git commit d8a57f8a19f05a0f84c8f7a9d48ea87775cfad45 by Dan Vrátil.
Committed on 14/05/2013 at 15:35.
Pushed by dvratil into branch 'KDE/4.10'.

Force full-resync if last sync was more than 25 days ago

Fixes 'The requested minimum modification time lies too far in the past'
error from Google Calendar resource that users saw after they returned
from vacation :-)

Also simplifies the code and speeds up sync by not fetching all existing
items before fetching data from Google (I probably copy-pasted it from
somewhere in the early days without actually understanding what's going on)
FIXED-IN: 4.10.4

M  +38   -52   resources/google/calendar/calendarresource.cpp
M  +0    -1    resources/google/calendar/calendarresource.h
M  +8    -1    resources/google/calendar/resource_events.cpp
M  +7    -1    resources/google/calendar/resource_tasks.cpp

http://commits.kde.org/kdepim-runtime/d8a57f8a19f05a0f84c8f7a9d48ea87775cfad45
Comment 6 Mark Fraser 2013-05-14 15:19:23 UTC
Is there any way of resetting the resource number back to zero?
Comment 7 Daniel Vrátil 2013-05-15 09:08:09 UTC
As in the akonadi_googlecalendar_X number? Yes, theoretically, by editing respective InstanceCounter in ~/.config/akonadi/agentsrc. There's not guarantee things won't go nuts however.
Comment 8 Mark Fraser 2013-05-15 14:47:39 UTC
Yes, that is the one I was on about.
Comment 9 Mark Fraser 2013-06-17 08:27:07 UTC
Just tried it and resetting the InstanceCounter doesn't work, it still increments to the next value.
Comment 10 Daniel Vrátil 2013-06-17 09:02:22 UTC
There's really no point in doing that. Just remove the resource and add it again.