mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-14 12:49:54 +05:00
Fix flushdb command
This commit is contained in:
@@ -79,7 +79,7 @@ func (rs *RedisStorage) Close() {
|
||||
}
|
||||
|
||||
func (rs *RedisStorage) Flush(ignore string) error {
|
||||
return rs.db.Cmd("FLUSH").Err
|
||||
return rs.db.Cmd("FLUSHDB").Err
|
||||
}
|
||||
|
||||
func (rs *RedisStorage) GetKeysForPrefix(prefix string) ([]string, error) {
|
||||
@@ -620,18 +620,6 @@ func (rs *RedisStorage) GetAccount(key string) (ub *Account, err error) {
|
||||
}
|
||||
|
||||
func (rs *RedisStorage) SetAccount(ub *Account) (err error) {
|
||||
// never override existing account with an empty one
|
||||
// UPDATE: if all balances expired and were cleaned it makes
|
||||
// sense to write empty balance map
|
||||
if len(ub.BalanceMap) == 0 {
|
||||
if ac, err := rs.GetAccount(ub.Id); err == nil && !ac.allBalancesExpired() {
|
||||
ac.ActionTriggers = ub.ActionTriggers
|
||||
ac.UnitCounters = ub.UnitCounters
|
||||
ac.AllowNegative = ub.AllowNegative
|
||||
ac.Disabled = ub.Disabled
|
||||
ub = ac
|
||||
}
|
||||
}
|
||||
result, err := rs.ms.Marshal(ub)
|
||||
err = rs.db.Cmd("SET", utils.ACCOUNT_PREFIX+ub.Id, result).Err
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user