fix: prevent firing registry events on heartbeat
This commit is contained in:
parent
2af9e734dd
commit
fc31d375a2
1 changed files with 9 additions and 0 deletions
|
|
@ -123,6 +123,15 @@ func (r *Registry) RemoveNode(node types.Node) error {
|
|||
|
||||
func (r *Registry) Set(nodes map[string]types.Node) error {
|
||||
r.lock.Lock()
|
||||
equalFunc := func(a, b types.Node) bool {
|
||||
return a.Hostname == b.Hostname
|
||||
}
|
||||
|
||||
if maps.EqualFunc(r.nodes, nodes, equalFunc) {
|
||||
r.lock.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
r.nodes = maps.Clone(nodes)
|
||||
snapshot := r.snapshot()
|
||||
r.lock.Unlock()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue