Skip to content

Commit

Permalink
bug fix #7 org quota memory
Browse files Browse the repository at this point in the history
  • Loading branch information
avasseur-pivotal committed Feb 9, 2019
1 parent e978314 commit 94fa4bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cf_bcr.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (c *Events) GetMetadata() plugin.PluginMetadata {
Name: "bcr",
Version: plugin.VersionType{
Major: 2,
Minor: 1,
Minor: 2,
Build: 0,
},
Commands: []plugin.Command{
Expand Down
7 changes: 6 additions & 1 deletion search_orgsummary.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ func (c Events) GetOrgsSummary(cli plugin.CliConnection) map[string]OrgSummary {
quotaCache[val.Entity.QuotaGuid] = orgQuota
}
orgSummary.MemoryLimitOrgQuota = orgQuota.Entity.MemoryLimit
orgSummary.MemoryUsage = (int)(orgSummary.Memory * 100 / orgSummary.MemoryLimitOrgQuota)
// special case for quota <=0 - see https://github.com/avasseur-pivotal/cf_get_events/issues/7
if orgSummary.MemoryLimitOrgQuota > 0 {
orgSummary.MemoryUsage = (int)(orgSummary.Memory * 100 / orgSummary.MemoryLimitOrgQuota)
} else {
orgSummary.MemoryUsage = 0
}
data[val.Metadata.GUID] = orgSummary
}

Expand Down

0 comments on commit 94fa4bc

Please sign in to comment.