Update jobs on background thread

This commit is contained in:
Brett Williams
2023-06-02 12:10:49 -05:00
parent 23abbd836c
commit 4331d81a97
3 changed files with 44 additions and 33 deletions

View File

@@ -48,8 +48,9 @@ class ZeroconfServer():
def _browse_services(self):
browser = ServiceBrowser(self.zeroconf, self.service_type, [self._on_service_discovered])
def _on_service_discovered(self, zeroconf, service_type, name, state_change=None):
def _on_service_discovered(self, zeroconf, service_type, name, state_change):
info = zeroconf.get_service_info(service_type, name)
logger.debug(f"Zeroconf: {name} {state_change}")
if service_type == self.service_type:
if state_change == ServiceStateChange.Added or state_change == ServiceStateChange.Updated:
self.client_cache[name] = info