Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions zeroconf/asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,15 @@ async def async_run(self) -> None:
"""Run the browser task."""
self.run()
while True:
if not self._handlers_to_call:
# Wait for the type has the smallest next time
next_time = min(self._next_time.values())
now = current_time_millis()
if next_time > now:
await self.aiozc.async_wait(next_time - now)
timeout = self._seconds_to_wait()
if timeout:
async with self.aiozc.condition:
# We must check again while holding the condition
# in case the other thread has added to _handlers_to_call
# between when we checked above when we were not
# holding the condition
if not self._handlers_to_call:
await wait_condition_or_timeout(self.aiozc.condition, timeout)

out = self.generate_ready_queries()
if out:
Expand Down