File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,6 +89,12 @@ def instance_name_from_service_info(info: "ServiceInfo") -> str:
8989_cached_ip_addresses = lru_cache (maxsize = 256 )(ip_address )
9090
9191
92+ def _set_future_none_if_not_done (fut : asyncio .Future ) -> None :
93+ """Set a future to None if it is not done."""
94+ if not fut .done (): # pragma: no branch
95+ fut .set_result (None )
96+
97+
9298class ServiceInfo (RecordUpdateListener ):
9399 """Service information.
94100
@@ -235,7 +241,7 @@ async def async_wait(self, timeout: float) -> None:
235241 loop = asyncio .get_running_loop ()
236242 future = loop .create_future ()
237243 self ._new_records_futures .append (future )
238- handle = loop .call_later (millis_to_seconds (timeout ), future . set_result , None )
244+ handle = loop .call_later (millis_to_seconds (timeout ), _set_future_none_if_not_done , future )
239245 try :
240246 await future
241247 finally :
You can’t perform that action at this time.
0 commit comments