From 731a33b3bd4a3585d6e627f81699d1c154c7ebe9 Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Wed, 6 Jan 2016 14:29:11 +0200 Subject: [PATCH] unique refund account ids --- engine/calldesc.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/engine/calldesc.go b/engine/calldesc.go index 667f1656b..d372f1c98 100644 --- a/engine/calldesc.go +++ b/engine/calldesc.go @@ -745,10 +745,15 @@ func (cd *CallDescriptor) RefundIncrements() (left float64, err error) { cd.account = nil // make sure it's not cached // get account list for locking // all must be locked in order to use cache + accMap := make(map[string]struct{}) var accountIDs []string for _, increment := range cd.Increments { - accountIDs = append(accountIDs, increment.BalanceInfo.AccountId) + accMap[increment.BalanceInfo.AccountId] = struct{}{} } + for key := range accMap { + accountIDs = append(accountIDs, key) + } + // start increment refunding loop Guardian.Guard(func() (interface{}, error) { accountsCache := make(map[string]*Account) for _, increment := range cd.Increments {