Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/zeroconf/_services/browser.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,5 @@ cdef class _ServiceBrowserBase(RecordUpdateListener):
cpdef _async_send_ready_queries(self, object now)

cpdef _cancel_send_timer(self)

cpdef async_update_records_complete(self)
10 changes: 7 additions & 3 deletions src/zeroconf/_services/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import random
import threading
import warnings
from abc import abstractmethod
from types import TracebackType # noqa # used in type hints
from typing import (
TYPE_CHECKING,
Expand Down Expand Up @@ -437,14 +436,18 @@ def async_update_records(self, zc: 'Zeroconf', now: float_, records: List[Record
for type_, name in self._names_matching_types((record.name,)):
self._enqueue_callback(SERVICE_STATE_CHANGE_UPDATED, type_, name)

@abstractmethod
def async_update_records_complete(self) -> None:
"""Called when a record update has completed for all handlers.

At this point the cache will have the new records.

This method will be run in the event loop.

This method is expected to be overridden by subclasses.
"""
for pending in self._pending_handlers.items():
self._fire_service_state_changed_event(pending)
self._pending_handlers.clear()

def _fire_service_state_changed_event(self, event: Tuple[Tuple[str, str], ServiceStateChange]) -> None:
"""Fire a service state changed event.
Expand All @@ -454,7 +457,8 @@ def _fire_service_state_changed_event(self, event: Tuple[Tuple[str, str], Servic

When running with AsyncServiceBrowser, this will happen in the event loop.
"""
name_type, state_change = event
name_type = event[0]
state_change = event[1]
self._service_state_changed.fire(
zeroconf=self.zc,
service_type=name_type[1],
Expand Down
11 changes: 0 additions & 11 deletions src/zeroconf/asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,6 @@ async def async_cancel(self) -> None:
"""Cancel the browser."""
self._async_cancel()

def async_update_records_complete(self) -> None:
"""Called when a record update has completed for all handlers.

At this point the cache will have the new records.

This method will be run in the event loop.
"""
for pending in self._pending_handlers.items():
self._fire_service_state_changed_event(pending)
self._pending_handlers.clear()

async def __aenter__(self) -> 'AsyncServiceBrowser':
return self

Expand Down