From 47a4a0410c75f852fa330fd8eafb7dcac83d856f Mon Sep 17 00:00:00 2001 From: DuodenumL Date: Fri, 4 Mar 2022 12:03:01 +0800 Subject: [PATCH] fix Eru "Pod Resource" function returned duplicated (#556) --- cluster/calcium/resource.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cluster/calcium/resource.go b/cluster/calcium/resource.go index d71552f2b..a10423297 100644 --- a/cluster/calcium/resource.go +++ b/cluster/calcium/resource.go @@ -26,11 +26,12 @@ func (c *Calcium) PodResource(ctx context.Context, podname string) (chan *types. go func() { defer close(ch) for node := range nodeCh { + nodename := node.Name pool.Go(ctx, func() { - nodeResource, err := c.doGetNodeResource(ctx, node.Name, false) + nodeResource, err := c.doGetNodeResource(ctx, nodename, false) if err != nil { nodeResource = &types.NodeResource{ - Name: node.Name, Diffs: []string{logger.Err(ctx, err).Error()}, + Name: nodename, Diffs: []string{logger.Err(ctx, err).Error()}, } } ch <- nodeResource