diff --git a/plugins/apple-calendar/src/sync.rs b/plugins/apple-calendar/src/sync.rs index 679ae38c28..607c8ef41d 100644 --- a/plugins/apple-calendar/src/sync.rs +++ b/plugins/apple-calendar/src/sync.rs @@ -401,7 +401,7 @@ async fn list_system_events_for_calendars( let filter = EventFilter { calendar_tracking_id: calendar_tracking_id.clone(), from: now, - to: now + chrono::Duration::days(28), + to: now + chrono::Duration::days(100), }; // Add small delay between API calls to avoid overwhelming EventKit @@ -480,11 +480,11 @@ async fn list_db_events( .list_events(Some(ListEventFilter { common: ListEventFilterCommon { user_id: user_id.into(), - limit: Some(200), + limit: Some(700), }, specific: ListEventFilterSpecific::DateRange { start: Utc::now(), - end: Utc::now() + chrono::Duration::days(28), + end: Utc::now() + chrono::Duration::days(100), }, })) .await @@ -562,28 +562,24 @@ impl CalendarSyncState { impl EventSyncState { async fn execute(self, db: &hypr_db_user::UserDatabase) { - // 1. Create new events first for event in self.to_upsert { if let Err(e) = db.upsert_event(event).await { tracing::error!("upsert_event_error: {}", e); } } - // 2. Update existing events for event in self.to_update { if let Err(e) = db.update_event(event).await { tracing::error!("update_event_error: {}", e); } } - // 3. Transfer sessions from old events to new events for (session_id, new_event_id) in self.session_transfers { if let Err(e) = db.session_set_event(session_id, Some(new_event_id)).await { tracing::error!("session_transfer_error: {}", e); } } - // 4. Delete old events last (after sessions have been transferred) for event in self.to_delete { if let Err(e) = db.delete_event(&event.id).await { tracing::error!("delete_event_error: {}", e);