From 9e9e1f75f245a89f5160f89a3eea087ef44d8ef1 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 29 May 2024 09:55:12 -1000 Subject: [PATCH] Fix google_mail doing blocking I/O in the event loop (#118421) fixes #118411 --- homeassistant/components/google_tasks/api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/google_tasks/api.py b/homeassistant/components/google_tasks/api.py index ed70f2f6f44..22e5e80229a 100644 --- a/homeassistant/components/google_tasks/api.py +++ b/homeassistant/components/google_tasks/api.py @@ -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."""