Skip processing if lease hasn't changed to avoid unnecessary wake-ups

This commit is contained in:
Alex Ballas 2025-05-29 15:25:51 +03:00
parent 3cd75c8de7
commit 41f9d6102f
1 changed files with 7 additions and 0 deletions

View File

@ -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 {