Skip to content

Commit

Permalink
set the unreachable nodes as unavailable (#508)
Browse files Browse the repository at this point in the history
  • Loading branch information
DuodenumL authored Nov 23, 2021
1 parent 4c093d1 commit 3a18622
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rpc/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ func toRPCNetwork(n *enginetypes.Network) *pb.Network {

func toRPCNode(ctx context.Context, n *types.Node) *pb.Node {
var nodeInfo string
if info, err := n.Info(ctx); err == nil {
var info *enginetypes.Info
var err error
if info, err = n.Info(ctx); err == nil {
bytes, _ := json.Marshal(info)
nodeInfo = string(bytes)
} else {
Expand All @@ -70,7 +72,7 @@ func toRPCNode(ctx context.Context, n *types.Node) *pb.Node {
StorageUsed: n.StorageUsed(),
Volume: n.Volume,
VolumeUsed: n.VolumeUsed,
Available: n.Available,
Available: n.Available && err == nil,
Labels: n.Labels,
InitCpu: toRPCCPUMap(n.InitCPU),
InitMemory: n.InitMemCap,
Expand Down

0 comments on commit 3a18622

Please sign in to comment.