mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Fix google_mail doing blocking I/O in the event loop (#118421)
fixes #118411
This commit is contained in:
parent
43ceb1c6c8
commit
9e9e1f75f2
@ -1,5 +1,6 @@
|
||||
"""API for Google Tasks bound to Home Assistant OAuth."""
|
||||
|
||||
from functools import partial
|
||||
import json
|
||||
import logging
|
||||
from typing import Any
|
||||
@ -52,7 +53,9 @@ class AsyncConfigEntryAuth:
|
||||
async def _get_service(self) -> Resource:
|
||||
"""Get current resource."""
|
||||
token = await self.async_get_access_token()
|
||||
return build("tasks", "v1", credentials=Credentials(token=token))
|
||||
return await self._hass.async_add_executor_job(
|
||||
partial(build, "tasks", "v1", credentials=Credentials(token=token))
|
||||
)
|
||||
|
||||
async def list_task_lists(self) -> list[dict[str, Any]]:
|
||||
"""Get all TaskList resources."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user