Skip to content

Commit

Permalink
Fix asyncio.gather call (#107500)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p authored Jan 8, 2024
1 parent 3709475 commit 442eb68
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions homeassistant/components/microsoft_face/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
from __future__ import annotations

import asyncio
from collections.abc import Coroutine
import json
import logging
from typing import Any

import aiohttp
from aiohttp.hdrs import CONTENT_TYPE
Expand Down Expand Up @@ -267,11 +269,11 @@ def store(self):
"""Store group/person data and IDs."""
return self._store

async def update_store(self):
async def update_store(self) -> None:
"""Load all group/person data into local store."""
groups = await self.call_api("get", "persongroups")

remove_tasks = []
remove_tasks: list[Coroutine[Any, Any, None]] = []
new_entities = []
for group in groups:
g_id = group["personGroupId"]
Expand All @@ -293,7 +295,7 @@ async def update_store(self):
self._store[g_id][person["name"]] = person["personId"]

if remove_tasks:
await asyncio.gather(remove_tasks)
await asyncio.gather(*remove_tasks)
await self._component.async_add_entities(new_entities)

async def call_api(self, method, function, data=None, binary=False, params=None):
Expand Down

0 comments on commit 442eb68

Please sign in to comment.