fix: retry individual Apple calendar fetches on network timeout

Batch errors like 'fetch failed' were only retried at the login/client-init
level. Per-calendar fetchCalendarObjects calls had no retry, so a single
transient iCloud network timeout silently dropped all events from that
calendar. Now wraps each fetchCalendarObjects with withRetry(2 retries, 3s/6s).

v1.77.5
This commit is contained in:
mARTin 2026-03-29 16:29:26 +02:00
parent 4c1ef5019e
commit b8c8e9257a
2 changed files with 11 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "my-weekly-todo-list", "name": "my-weekly-todo-list",
"version": "1.77.4", "version": "1.77.5",
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view", "description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -496,13 +496,16 @@ export const getUpcomingEventsBatch = async (
continue; continue;
} }
const events = await client.fetchCalendarObjects({ const events = await withRetry(
() => client.fetchCalendarObjects({
calendar: targetCalendar, calendar: targetCalendar,
timeRange: { timeRange: {
start: new Date(timeMin).toISOString(), start: new Date(timeMin).toISOString(),
end: new Date(timeMax).toISOString(), end: new Date(timeMax).toISOString(),
}, },
}); }),
2, `fetchCalendarObjects:${calendarUrl.split('/').pop()}`
);
const parsedEvents: AppleCalendarEvent[] = []; const parsedEvents: AppleCalendarEvent[] = [];
const minTime = new Date(timeMin).getTime(); const minTime = new Date(timeMin).getTime();