mirror of https://github.com/jetkvm/kvm.git
Skip processing if lease hasn't changed to avoid unnecessary wake-ups
This commit is contained in:
parent
3cd75c8de7
commit
41f9d6102f
|
@ -5,6 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"reflect"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/fsnotify/fsnotify"
|
"github.com/fsnotify/fsnotify"
|
||||||
|
@ -149,6 +150,12 @@ func (c *DHCPClient) loadLeaseFile() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
isFirstLoad := c.lease == nil
|
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
|
c.lease = lease
|
||||||
|
|
||||||
if lease.IPAddress == nil {
|
if lease.IPAddress == nil {
|
||||||
|
|
Loading…
Reference in New Issue