Skip to content

Commit

Permalink
Merge pull request #39 from chez-shanpu/hotfix-make-graph
Browse files Browse the repository at this point in the history
Hotfix MakeGraph
  • Loading branch information
chez-shanpu committed Jul 23, 2021
2 parents a821a76 + 824163d commit b9f2ea6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/appagent/appagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const startVertexName = "start"
const ratioMetricsTypeOption = "ratio"
const bytesMetricsTypeOption = "bytes"
const infCost = 999999
const byteToBit = 8.0
const byteToBit = 8

func GetSRNodesInfo(tls bool, certFilePath, mntAddr string) (*api.NodesInfo, error) {
var opts []grpc.DialOption
Expand Down Expand Up @@ -63,7 +63,7 @@ func MakeGraph(nodesInfo *api.NodesInfo, metricsType string, require float64) (*
cost = infCost
}
} else if metricsType == bytesMetricsTypeOption {
if require <= (float64(node.LinkCap)-node.LinkUsageBytes)*byteToBit {
if int64(require) <= (node.LinkCap - int64(node.LinkUsageBytes*byteToBit)) {
cost = 1
} else {
cost = infCost
Expand Down

0 comments on commit b9f2ea6

Please sign in to comment.