diff --git a/engine/destinations.go b/engine/destinations.go index 770f7354b..b43e0d3a1 100644 --- a/engine/destinations.go +++ b/engine/destinations.go @@ -20,6 +20,7 @@ package engine import ( "encoding/json" + "sort" "strings" "github.com/cgrates/cgrates/cache2go" @@ -92,6 +93,7 @@ func CleanStalePrefixes(destIds []string) { for prefix, idIDs := range prefixMap { dIDs := idIDs.Value().([]interface{}) changed := false + sort.Sort(utils.InterfaceStrings(dIDs)) for _, searchedDID := range destIds { if i, found := utils.GetSliceInterfaceIndex(dIDs, searchedDID); found { if len(dIDs) == 1 { diff --git a/utils/slice.go b/utils/slice.go index 1e1bb7879..ecd80157a 100644 --- a/utils/slice.go +++ b/utils/slice.go @@ -61,7 +61,6 @@ func (a InterfaceStrings) Less(i, j int) bool { return a[i].(string) < a[j].(str // Binary string search in slice // returns true if found and the index func GetSliceInterfaceIndex(ss []interface{}, s interface{}) (int, bool) { - sort.Sort(InterfaceStrings(ss)) if i := sort.Search(len(ss), func(i int) bool { return ss[i].(string) >= s.(string) }); i < len(ss) && ss[i] == s { return i, true }