pbacsko commented on code in PR #853:
URL: https://github.com/apache/yunikorn-core/pull/853#discussion_r1575069800
##########
pkg/scheduler/partition.go:
##########
@@ -608,7 +608,7 @@ func (pc *PartitionContext) addNodeResources(node
*objects.Node) {
if pc.totalPartitionResource == nil {
pc.totalPartitionResource = node.GetCapacity().Clone()
} else {
- pc.totalPartitionResource.AddTo(node.GetCapacity())
Review Comment:
`AddTo()` & its pairs have their use, see `total` in `removeAllocation()`.
That's a local resource object which will not be stored anywhere and its
lifecycle ends after the method returns. So this is how it's supposed to be
used. But for variables which are potentially read&processed by other
goroutines, using the immutable approach is safer because it just works without
`Clone()`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]