-- 031_calendar_subscriptions.sql -- Oppgave 29.12: CalDAV-abonnement — periodisk polling av eksterne kalendere. -- Kalenderabonnementer lagres i samlingens metadata.calendar_subscriptions[], -- etter samme mønster som feed_subscriptions (oppgave 29.3). -- -- Inneholder: -- 1. Indeks for rask oppslag av calendar_subscriptions -- 2. Prioritetsregel for calendar_poll-jobber -- -- Ref: docs/features/kalender.md, tools/synops-calendar/ BEGIN; -- ============================================================================= -- 1. Indeks for rask oppslag av samlinger med calendar_subscriptions -- ============================================================================= CREATE INDEX IF NOT EXISTS idx_nodes_calendar_subscriptions ON nodes ((metadata->'calendar_subscriptions')) WHERE node_kind = 'collection' AND metadata ? 'calendar_subscriptions'; -- ============================================================================= -- 2. Prioritetsregel for calendar_poll-jobber -- ============================================================================= -- Lav prioritet (3), lav CPU-vekt, maks 2 samtidige, 120s timeout. -- Kalender-polling er bakgrunnsarbeid som ikke haster. INSERT INTO job_priority_rules (job_type, base_priority, cpu_weight, max_concurrent, timeout_seconds) VALUES ('calendar_poll', 3, 1, 2, 120) ON CONFLICT (job_type) DO NOTHING; COMMIT;