Skip to content

Commit 9056189

Browse files
committed
Prevent storing an "updated" ClusterConfig when it has not changed
1 parent ffbed61 commit 9056189

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

service/service.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"net"
3434
"net/http"
3535
"path/filepath"
36+
"reflect"
3637
"strconv"
3738
"strings"
3839
"sync"
@@ -1043,9 +1044,14 @@ func (s *Service) UpdateClusterConfig(newConfig ClusterConfig) {
10431044
return
10441045
}
10451046

1046-
// TODO only update when changed
1047-
s.myPeers = newConfig
1048-
s.saveSetup()
1047+
// Only update when changed
1048+
if !reflect.DeepEqual(s.myPeers, newConfig) {
1049+
s.myPeers = newConfig
1050+
s.saveSetup()
1051+
s.log.Debug().Msg("Updated cluster config")
1052+
} else {
1053+
s.log.Debug().Msg("Updating cluster config is not needed")
1054+
}
10491055
}
10501056

10511057
// MasterChangedCallback interrupts the runtime cluster manager

0 commit comments

Comments
 (0)