[Performance] Chunk calendar source cleanup for large subscriptions #9

Closed
opened 2026-07-11 11:39:42 +02:00 by zemion · 1 comment
Owner

Calendar sync cleanup loads all active source events into memory and compares every href in Python. Large ICS/CalDAV/Graph sources can make this expensive.

Code path: src/govoplan_calendar/backend/service.py:1330.

Acceptance: cleanup processes rows in chunks or performs DB-side filtering where practical, memory use is bounded for large sources, and tests verify unchanged behavior.

Calendar sync cleanup loads all active source events into memory and compares every href in Python. Large ICS/CalDAV/Graph sources can make this expensive. Code path: `src/govoplan_calendar/backend/service.py:1330`. Acceptance: cleanup processes rows in chunks or performs DB-side filtering where practical, memory use is bounded for large sources, and tests verify unchanged behavior. <!-- codex-audit-2026-07-11:calendar-cleanup -->
zemion added the
type
debt
status
ready
priority
p3
module/calendar
area/db
codex/ready
labels 2026-07-11 11:39:42 +02:00
Author
Owner

Codex State: done

Summary

  • Implemented bounded full-sync cleanup for CalDAV source events so full sync no longer materializes every active source event before soft-deleting stale rows.

Changed Files

  • src/govoplan_calendar/backend/service.py
  • tests/test_sync_sources.py
  • tests/test_caldav.py

Verification

  • PYTHONPATH=/mnt/DATA/git/govoplan-core/src:/mnt/DATA/git/govoplan-access/src:/mnt/DATA/git/govoplan-tenancy/src:/mnt/DATA/git/govoplan-calendar/src /mnt/DATA/git/govoplan/.venv/bin/python -m unittest tests.test_sync_sources tests.test_caldav
  • PYTHONPATH=/mnt/DATA/git/govoplan-core/src:/mnt/DATA/git/govoplan-access/src:/mnt/DATA/git/govoplan-tenancy/src:/mnt/DATA/git/govoplan-calendar/src /mnt/DATA/git/govoplan/.venv/bin/python -m compileall -q src tests
## Codex State: done ### Summary - Implemented bounded full-sync cleanup for CalDAV source events so full sync no longer materializes every active source event before soft-deleting stale rows. ### Changed Files - `src/govoplan_calendar/backend/service.py` - `tests/test_sync_sources.py` - `tests/test_caldav.py` ### Verification - `PYTHONPATH=/mnt/DATA/git/govoplan-core/src:/mnt/DATA/git/govoplan-access/src:/mnt/DATA/git/govoplan-tenancy/src:/mnt/DATA/git/govoplan-calendar/src /mnt/DATA/git/govoplan/.venv/bin/python -m unittest tests.test_sync_sources tests.test_caldav` - `PYTHONPATH=/mnt/DATA/git/govoplan-core/src:/mnt/DATA/git/govoplan-access/src:/mnt/DATA/git/govoplan-tenancy/src:/mnt/DATA/git/govoplan-calendar/src /mnt/DATA/git/govoplan/.venv/bin/python -m compileall -q src tests`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: add-ideas/govoplan-calendar#9
No description provided.