mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-22 07:38:45 +05:00
clean expired balances on debit
This commit is contained in:
@@ -111,9 +111,10 @@ func (ub *Account) debitBalanceAction(a *Action) error {
|
||||
}
|
||||
found := false
|
||||
id := a.BalanceType + a.Direction
|
||||
ub.CleanExpiredBalances()
|
||||
for _, b := range ub.BalanceMap[id] {
|
||||
if b.IsExpired() {
|
||||
continue // we can clean expired balances balances here
|
||||
continue // just to be safe (cleaned expired balances above)
|
||||
}
|
||||
if b.Equal(a.Balance) {
|
||||
b.SubstractAmount(a.Balance.Value)
|
||||
|
||||
Reference in New Issue
Block a user