Skip to content

Commit a788360

Browse files
committed
Add comments to hasNodeChanged and remove superfluous else block
1 parent 035cc02 commit a788360

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

client/client.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,10 @@ func (c *Client) run() {
656656
}
657657
}
658658

659+
// hasNodeChanged calculates a hash for the node attributes- and meta map.
660+
// The new hash values are compared against the old (passed-in) hash values to
661+
// determine if the node properties have changed. It returns the new hash values
662+
// in case they are different from the old hash values.
659663
func (c *Client) hasNodeChanged(oldAttrHash uint64, oldMetaHash uint64) (bool, uint64, uint64) {
660664
newAttrHash, err := hashstructure.Hash(c.config.Node.Attributes, nil)
661665
if err != nil {
@@ -668,9 +672,8 @@ func (c *Client) hasNodeChanged(oldAttrHash uint64, oldMetaHash uint64) (bool, u
668672
}
669673
if newAttrHash != oldAttrHash || newMetaHash != oldMetaHash {
670674
return true, newAttrHash, newMetaHash
671-
} else {
672-
return false, oldAttrHash, oldMetaHash
673675
}
676+
return false, oldAttrHash, oldMetaHash
674677
}
675678

676679
// retryRegisterNode is used to register the node or update the registration and

0 commit comments

Comments
 (0)