mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-17 06:09:53 +05:00
ApierV1.GetLoadHistory implementation, console load_history command
This commit is contained in:
@@ -706,13 +706,16 @@ func (rs *RedisStorage) GetLoadHistory(limit int, skipCache bool) ([]*LoadInstan
|
||||
return nil, err
|
||||
} else {
|
||||
items := x.([]*LoadInstance)
|
||||
if len(items) < limit {
|
||||
if len(items) < limit || limit == -1 {
|
||||
return items, nil
|
||||
}
|
||||
return items[:limit], nil
|
||||
}
|
||||
}
|
||||
marshaleds, err := rs.db.Lrange(utils.LOADINST_KEY, 0, limit-1)
|
||||
if limit != -1 {
|
||||
limit -= -1 // Decrease limit to match redis approach on lrange
|
||||
}
|
||||
marshaleds, err := rs.db.Lrange(utils.LOADINST_KEY, 0, limit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user