diff --git a/api/ovdashboard_api/__init__.py b/api/ovdashboard_api/__init__.py index edeb9eb..4fa6c6e 100644 --- a/api/ovdashboard_api/__init__.py +++ b/api/ovdashboard_api/__init__.py @@ -48,6 +48,5 @@ _CALDAV_CLIENT = caldav.DAVClient( ) -@run_in_executor def caldav_principal() -> caldav.Principal: return _CALDAV_CLIENT.principal() diff --git a/api/ovdashboard_api/routers/_common.py b/api/ovdashboard_api/routers/_common.py index b6f47f7..58cc388 100644 --- a/api/ovdashboard_api/routers/_common.py +++ b/api/ovdashboard_api/routers/_common.py @@ -37,11 +37,9 @@ class FileNameLister: @dataclass(frozen=True) class CalendarNameLister: async def __call__(self) -> Iterator[str]: - principal = await caldav_principal() - return ( cal.name - for cal in principal.calendars() + for cal in caldav_principal().calendars() ) diff --git a/api/ovdashboard_api/routers/calendar.py b/api/ovdashboard_api/routers/calendar.py index dab9de2..55b1ece 100644 --- a/api/ovdashboard_api/routers/calendar.py +++ b/api/ovdashboard_api/routers/calendar.py @@ -1,7 +1,6 @@ from datetime import datetime, timedelta from typing import Iterator -import caldav from fastapi import APIRouter, Depends, HTTPException, status from .. import caldav_principal @@ -39,8 +38,7 @@ async def get_calendar( elif len(calendar_names) > 1: raise HTTPException(status_code=status.HTTP_409_CONFLICT) - principal: caldav.Principal = await caldav_principal() - calendar = principal.calendar(name=calendar_names[0]) + calendar = caldav_principal().calendar(name=calendar_names[0]) events = []