[bug ?] Calendar update not instant

Hello,
This week I modified one of my heating calendars: in short, I deleted all the events.
The sync in Gladys didn’t happen, no change.
I forced the sync but still no change.
I left it running but nothing more.
And this morning I removed the sharing of this calendar (just in case), I resaved the configuration and restarted a sync and the events disappeared.

Could there be an issue with recurring events or an automatic sync that isn’t working anymore?

I have my availability logs for analysis if needed.

Hi @mutmut, thanks for the feedback.

I’d love to have the logs to pass everything to Claude for analysis :slight_smile:

Thanks a lot @mutmut for the report and for the logs, they helped identify a real bug :folded_hands:

What was happening

Your logs show that the CalDAV sync was running every 30 minutes, but never applying anything:

09:31:33  CalDAV : Found calendar Chauffage
09:31:33  CalDAV : Found 4 calendars.

…and nothing else for 17 hours straight. No errors, but no changes either.

Your intuition about recurring events was correct. In Gladys, a recurring event is stored as one line per occurrence (your Chauffage calendar contains 575). However, when the CalDAV server reported the deletion of an event, Gladys only deleted it if it found exactly one matching occurrence. For a recurring event, there were hundreds, so the condition was never met and nothing was deleted. As this case produced no log lines, the sync appeared to have stopped working altogether.

Two aggravating issues were found along the way:

  1. Gladys marked the calendar as „up to date“ before actually applying the changes. Once the deletion failed, these changes were therefore lost forever, and subsequent syncs never requested them again. This is exactly why forcing the sync didn’t change anything: only a complete reimport (what the configuration backup does) could fix it, and you had found the right workaround.
  2. When a recurrence rule was shortened or an occurrence was removed, the old occurrences remained in the database indefinitely.

What has been fixed

  • All occurrences of a deleted recurring event are now properly deleted.
  • The ctag / sync token is only recorded after the changes have been applied: no more calendars permanently stuck in case of failure.
  • Occurrences that no longer exist on the server are cleaned up.
  • Calendars are synchronized as soon as the service starts, instead of waiting 30 minutes (visible in your logs: service started at 09:01:33, first sync at 09:31:33).
  • Logs now also indicate the number of deleted events, so that this kind of issue is visible.

The fix is here: Improve CalDAV sync: handle deleted events and defer ctag updates by Pierre-Gilles · Pull Request #2712 · GladysAssistant/Gladys · GitHub

Note: The CalDAV sync remains based on a refresh every 30 minutes, so it cannot be instantaneous in the strict sense. But a change should now be taken into account at the next sync, without ever getting stuck.

The fix is live in Gladys Assistant 4.84