From 41f9d6102fb8cab50a365500a734afe264a2bbbb Mon Sep 17 00:00:00 2001 From: Alex Ballas Date: Thu, 29 May 2025 15:25:51 +0300 Subject: [PATCH] Skip processing if lease hasn't changed to avoid unnecessary wake-ups --- internal/udhcpc/udhcpc.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/udhcpc/udhcpc.go b/internal/udhcpc/udhcpc.go index 70ac1b8..128ea66 100644 --- a/internal/udhcpc/udhcpc.go +++ b/internal/udhcpc/udhcpc.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "path/filepath" + "reflect" "time" "github.com/fsnotify/fsnotify" @@ -149,6 +150,12 @@ func (c *DHCPClient) loadLeaseFile() error { } isFirstLoad := c.lease == nil + + // Skip processing if lease hasn't changed to avoid unnecessary wake-ups. + if reflect.DeepEqual(c.lease, lease) { + return nil + } + c.lease = lease if lease.IPAddress == nil {