mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 05:47:10 +00:00
Fix google calendar blocking call, running outside of executor (#68948)
This commit is contained in:
parent
4327d3aef9
commit
3c478c312a
@ -183,10 +183,14 @@ class GoogleCalendarService:
|
|||||||
"""Get the calendar service with valid credetnails."""
|
"""Get the calendar service with valid credetnails."""
|
||||||
await self._session.async_ensure_token_valid()
|
await self._session.async_ensure_token_valid()
|
||||||
creds = _async_google_creds(self._hass, self._session.token)
|
creds = _async_google_creds(self._hass, self._session.token)
|
||||||
|
|
||||||
|
def _build() -> google_discovery.Resource:
|
||||||
return google_discovery.build(
|
return google_discovery.build(
|
||||||
"calendar", "v3", credentials=creds, cache_discovery=False
|
"calendar", "v3", credentials=creds, cache_discovery=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return await self._hass.async_add_executor_job(_build)
|
||||||
|
|
||||||
async def async_list_calendars(
|
async def async_list_calendars(
|
||||||
self,
|
self,
|
||||||
) -> list[dict[str, Any]]:
|
) -> list[dict[str, Any]]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user