Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 344fdd1

Browse filesBrowse files
authored
chore: cleanup _ServiceBrowserBase class to remove queue only used in sync version (#1147)
1 parent cc5dc74 commit 344fdd1
Copy full SHA for 344fdd1

File tree

1 file changed

+1
-5
lines changed
Filter options

1 file changed

+1
-5
lines changed

‎src/zeroconf/_services/browser.py

Copy file name to clipboardExpand all lines: src/zeroconf/_services/browser.py
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,6 @@ def __init__(
306306
self._pending_handlers: OrderedDict[Tuple[str, str], ServiceStateChange] = OrderedDict()
307307
self._service_state_changed = Signal()
308308
self.query_scheduler = QueryScheduler(self.types, delay, _FIRST_QUERY_DELAY_RANDOM_INTERVAL)
309-
self.queue: Optional[queue.SimpleQueue] = None
310309
self.done = False
311310
self._first_request: bool = True
312311
self._next_send_timer: Optional[asyncio.TimerHandle] = None
@@ -522,7 +521,7 @@ def __init__(
522521
# Add the queue before the listener is installed in _setup
523522
# to ensure that events run in the dedicated thread and do
524523
# not block the event loop
525-
self.queue = queue.SimpleQueue()
524+
self.queue: queue.SimpleQueue = queue.SimpleQueue()
526525
self.daemon = True
527526
self.start()
528527
zc.loop.call_soon_threadsafe(self._async_start)
@@ -534,14 +533,12 @@ def __init__(
534533
def cancel(self) -> None:
535534
"""Cancel the browser."""
536535
assert self.zc.loop is not None
537-
assert self.queue is not None
538536
self.queue.put(None)
539537
self.zc.loop.call_soon_threadsafe(self._async_cancel)
540538
self.join()
541539

542540
def run(self) -> None:
543541
"""Run the browser thread."""
544-
assert self.queue is not None
545542
while True:
546543
event = self.queue.get()
547544
if event is None:
@@ -555,6 +552,5 @@ def async_update_records_complete(self) -> None:
555552
556553
This method will be run in the event loop.
557554
"""
558-
assert self.queue is not None
559555
while self._pending_handlers:
560556
self.queue.put(self._pending_handlers.popitem(False))

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.