- Bugfix, fix consistent hash problem where
if failure happens then causes panic
This commit is contained in:
Tim Beatham 2023-12-28 23:24:38 +00:00
parent 77aac5534b
commit bf53108384

View File

@ -54,9 +54,6 @@ func (s *SyncerImpl) Sync(meshId string) error {
s.manager.GetRouteManager().UpdateRoutes()
publicKey := s.manager.GetPublicKey()
logging.Log.WriteInfof(publicKey.String())
nodeNames := correspondingMesh.GetPeers()
if self != nil {
@ -68,7 +65,7 @@ func (s *SyncerImpl) Sync(meshId string) error {
var gossipNodes []string
// Clients always pings its peer for configuration
if self != nil && self.GetType() == conf.CLIENT_ROLE {
if self != nil && self.GetType() == conf.CLIENT_ROLE && len(nodeNames) > 1 {
keyFunc := lib.HashString
bucketFunc := lib.HashString
@ -92,6 +89,7 @@ func (s *SyncerImpl) Sync(meshId string) error {
if correspondingPeer == nil {
logging.Log.WriteErrorf("node %s does not exist", node)
continue
}
err := s.requester.SyncMesh(meshId, correspondingPeer)
@ -104,6 +102,10 @@ func (s *SyncerImpl) Sync(meshId string) error {
// itself
s.manager.GetMesh(meshId).Mark(node)
}
if err != nil {
logging.Log.WriteInfof(err.Error())
}
}
s.syncCount++