fix limit on load history

This commit is contained in:
Radu Ioan Fericean
2016-06-20 13:53:25 +03:00
parent 6eb68b5db7
commit 4442ae3b85
2 changed files with 8 additions and 2 deletions

View File

@@ -1274,7 +1274,10 @@ func (ms *MongoStorage) GetLoadHistory(limit int, skipCache bool) (loadInsts []*
CacheRemKey(utils.LOADINST_KEY)
CacheSet(utils.LOADINST_KEY, loadInsts)
}
return loadInsts, nil
if len(loadInsts) < limit || limit == -1 {
return loadInsts, nil
}
return loadInsts[:limit], nil
}
// Adds a single load instance to load history

View File

@@ -934,7 +934,10 @@ func (rs *RedisStorage) GetLoadHistory(limit int, skipCache bool) ([]*utils.Load
}
CacheRemKey(utils.LOADINST_KEY)
CacheSet(utils.LOADINST_KEY, loadInsts)
return loadInsts, nil
if len(loadInsts) < limit || limit == -1 {
return loadInsts, nil
}
return loadInsts[:limit], nil
}
// Adds a single load instance to load history