Skip to content

Commit

Permalink
Expose priority for devices as well
Browse files Browse the repository at this point in the history
  • Loading branch information
puddly committed Oct 14, 2024
1 parent 24aad48 commit ec6a06b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions zigpy/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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",
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ec6a06b

Please # to comment.