File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,12 @@ def instance_name_from_service_info(info: "ServiceInfo") -> str:
89
89
_cached_ip_addresses = lru_cache (maxsize = 256 )(ip_address )
90
90
91
91
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
+
92
98
class ServiceInfo (RecordUpdateListener ):
93
99
"""Service information.
94
100
@@ -235,7 +241,7 @@ async def async_wait(self, timeout: float) -> None:
235
241
loop = asyncio .get_running_loop ()
236
242
future = loop .create_future ()
237
243
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 )
239
245
try :
240
246
await future
241
247
finally :
You can’t perform that action at this time.
0 commit comments