test stuff

This commit is contained in:
Samir Patel 2021-05-27 14:59:05 -05:00 committed by Samir Patel
parent 63300db1bd
commit fd58fe1a7d
2 changed files with 6 additions and 4 deletions

9
api.go
View file

@ -949,10 +949,10 @@ func (api *API) Usage(ctx context.Context, remote bool) (map[string]NodeUsage, e
api.usageCache.muRead.Lock()
defer api.usageCache.muRead.Unlock()
// var t time.Time
// if api.usageCache.lastUpdated == t {
api.calculateUsage()
// }
var t time.Time
if api.usageCache.lastUpdated == t {
api.calculateUsage()
}
if !remote {
api.requestUsageOfNodes()
@ -1051,6 +1051,7 @@ func (api *API) RefreshUsageCache(refresh time.Duration) {
data: make(map[string]NodeUsage),
refreshInterval: refresh,
}
time.Sleep(time.Second * 5)
for {
fmt.Println(1)
api.calculateUsage()

View file

@ -528,6 +528,7 @@ func TestHandler_Endpoints(t *testing.T) {
// }
for _, nodeUsage := range nodeUsages {
t.Logf("Len of Indexes: %+v\n", len(nodeUsage.Disk.IndexUsage))
numIndexes := len(nodeUsage.Disk.IndexUsage)
fmt.Printf("Node Usage: %+v\n", nodeUsage)
fmt.Printf("Disk Usage: %+v\n", nodeUsage.Disk)