diff --git a/zigpy/device.py b/zigpy/device.py index 68ab80fcb..75a0ef6f0 100644 --- a/zigpy/device.py +++ b/zigpy/device.py @@ -101,7 +101,7 @@ def __init__(self, application: ControllerApplication, ieee: t.EUI64, nwk: t.NWK self.status = Status.NEW @contextlib.asynccontextmanager - async def _limit_concurrency(self): + async def _limit_concurrency(self, *, priority: int = 0): """Async context manager to limit device request concurrency.""" start_time = time.monotonic() @@ -114,7 +114,7 @@ async def _limit_concurrency(self): self._concurrent_requests_semaphore.num_waiting, ) - async with self._concurrent_requests_semaphore: + async with self._concurrent_requests_semaphore(priority=priority): if was_locked: LOGGER.debug( "Previously delayed device request is now running, delayed by %0.2fs", @@ -365,7 +365,7 @@ async def request( priority=priority, ) - async with self._limit_concurrency(): + async with self._limit_concurrency(priority=priority): if not expect_reply: await send_request() return None