mirror of
https://github.com/home-assistant/core.git
synced 2025-08-02 10:08:23 +00:00
parent
e4be3d8435
commit
064659fce1
@ -276,6 +276,8 @@ class RequirementsManager:
|
|||||||
async with self.pip_lock:
|
async with self.pip_lock:
|
||||||
# Recalculate missing again now that we have the lock
|
# Recalculate missing again now that we have the lock
|
||||||
if missing := self._find_missing_requirements(requirements):
|
if missing := self._find_missing_requirements(requirements):
|
||||||
|
# Freeze all the timers since installing packages can take a long time
|
||||||
|
async with self.hass.timeout.async_freeze():
|
||||||
await self._async_process_requirements(name, missing)
|
await self._async_process_requirements(name, missing)
|
||||||
|
|
||||||
def _find_missing_requirements(self, requirements: list[str]) -> list[str]:
|
def _find_missing_requirements(self, requirements: list[str]) -> list[str]:
|
||||||
|
@ -74,11 +74,12 @@ class _GlobalFreezeContext:
|
|||||||
continue
|
continue
|
||||||
zone.pause()
|
zone.pause()
|
||||||
|
|
||||||
self._manager.global_freezes.append(self)
|
self._manager.global_freezes.add(self)
|
||||||
|
|
||||||
def _exit(self) -> None:
|
def _exit(self) -> None:
|
||||||
"""Finish freeze."""
|
"""Finish freeze."""
|
||||||
self._manager.global_freezes.remove(self)
|
self._manager.global_freezes.discard(self)
|
||||||
|
|
||||||
if not self._manager.freezes_done:
|
if not self._manager.freezes_done:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -423,7 +424,7 @@ class TimeoutManager:
|
|||||||
self._loop: asyncio.AbstractEventLoop = asyncio.get_running_loop()
|
self._loop: asyncio.AbstractEventLoop = asyncio.get_running_loop()
|
||||||
self._zones: dict[str, _ZoneTimeoutManager] = {}
|
self._zones: dict[str, _ZoneTimeoutManager] = {}
|
||||||
self._globals: list[_GlobalTaskContext] = []
|
self._globals: list[_GlobalTaskContext] = []
|
||||||
self._freezes: list[_GlobalFreezeContext] = []
|
self._freezes: set[_GlobalFreezeContext] = set()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def zones_done(self) -> bool:
|
def zones_done(self) -> bool:
|
||||||
@ -446,7 +447,7 @@ class TimeoutManager:
|
|||||||
return self._globals
|
return self._globals
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def global_freezes(self) -> list[_GlobalFreezeContext]:
|
def global_freezes(self) -> set[_GlobalFreezeContext]:
|
||||||
"""Return all global Freezes."""
|
"""Return all global Freezes."""
|
||||||
return self._freezes
|
return self._freezes
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user