Fix zeroconf listener being removed from zeroconf callback (#538)

This commit is contained in:
J. Nick Koston 2023-09-05 18:22:00 -05:00 committed by GitHub
parent c457081c61
commit ca254f150c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -279,6 +279,10 @@ class ReconnectLogic(zeroconf.RecordUpdateListener):
self._log_name,
record_update.new,
)
self._stop_zc_listen()
# We can't stop the zeroconf listener here because we are in the middle of
# a zeroconf callback which is iterating the listeners.
#
# So we schedule a stop for the next event loop iteration.
self.loop.call_soon(self._stop_zc_listen)
self._schedule_connect(0.0)
return