3333if TYPE_CHECKING :
3434 from .._core import Zeroconf
3535
36+ _float = float
37+
3638
3739class RecordManager :
3840 """Process records into the cache and notify listeners."""
@@ -45,7 +47,7 @@ def __init__(self, zeroconf: 'Zeroconf') -> None:
4547 self .cache = zeroconf .cache
4648 self .listeners : List [RecordUpdateListener ] = []
4749
48- def async_updates (self , now : float , records : List [RecordUpdate ]) -> None :
50+ def async_updates (self , now : _float , records : List [RecordUpdate ]) -> None :
4951 """Used to notify listeners of new information that has updated
5052 a record.
5153
@@ -81,6 +83,7 @@ def async_updates_from_response(self, msg: DNSIncoming) -> None:
8183 other_adds : List [DNSRecord ] = []
8284 removes : Set [DNSRecord ] = set ()
8385 now = msg .now
86+ now_float = now
8487 unique_types : Set [Tuple [str , int , int ]] = set ()
8588 cache = self .cache
8689
@@ -108,11 +111,11 @@ def async_updates_from_response(self, msg: DNSIncoming) -> None:
108111 record = cast (_UniqueRecordsType , record )
109112
110113 maybe_entry = cache .async_get_unique (record )
111- if not record .is_expired (now ):
114+ if not record .is_expired (now_float ):
112115 if maybe_entry is not None :
113116 maybe_entry .reset_ttl (record )
114117 else :
115- if record . type in _ADDRESS_RECORD_TYPES :
118+ if record_type in _ADDRESS_RECORD_TYPES :
116119 address_adds .append (record )
117120 else :
118121 other_adds .append (record )
@@ -146,7 +149,8 @@ def async_updates_from_response(self, msg: DNSIncoming) -> None:
146149 new = False
147150 if other_adds or address_adds :
148151 new = cache .async_add_records (address_adds )
149- new |= cache .async_add_records (other_adds )
152+ if cache .async_add_records (other_adds ):
153+ new = True
150154 # Removes are processed last since
151155 # ServiceInfo could generate an un-needed query
152156 # because the data was not yet populated.
0 commit comments