From 7d612f032831c4b09862cf7e700cbfe402ee5a22 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 6 Apr 2023 16:04:47 +0200 Subject: [PATCH] unbound-dhcp-leases-bridge: Only wait if all events have been processed This seems to solve a race condition where some hostnames where not properly passed to unbound - probably if there were too many DHCP updates in too short time. Signed-off-by: Michael Tremer --- config/unbound/unbound-dhcp-leases-bridge | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/unbound/unbound-dhcp-leases-bridge b/config/unbound/unbound-dhcp-leases-bridge index 3f4f10a900..1c927474ae 100644 --- a/config/unbound/unbound-dhcp-leases-bridge +++ b/config/unbound/unbound-dhcp-leases-bridge @@ -116,6 +116,9 @@ class UnboundDHCPLeasesBridge(object): for event in i.event_gen(): # Nothing to do if event is None: + # Wait a moment before we start the next iteration + time.sleep(5) + break # Decode the event @@ -143,9 +146,6 @@ class UnboundDHCPLeasesBridge(object): # Reset update_hosts = update_leases = False - # Wait a moment before we start the next iteration - time.sleep(5) - log.info("Unbound DHCP Leases Bridge terminated") def update_dhcp_leases(self): -- 2.39.5