mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-21 07:08:45 +05:00
Small optimization ApierV1.SetTPDerivedChargers
This commit is contained in:
@@ -406,8 +406,9 @@ func (self *SQLStorage) SetTPDerivedChargers(sgs []*utils.TPDerivedChargers) err
|
||||
m := make(map[string]bool)
|
||||
tx := self.db.Begin()
|
||||
for _, dCharger := range sgs {
|
||||
if found, _ := m[dCharger.Direction]; !found {
|
||||
m[dCharger.Direction] = true
|
||||
dcKey := dCharger.GetDerivedChargersKey()
|
||||
if found, _ := m[dcKey]; !found {
|
||||
m[dcKey] = true
|
||||
if err := tx.Delete(TpDerivedCharger{
|
||||
Tpid: dCharger.TPid,
|
||||
Direction: dCharger.Direction,
|
||||
|
||||
Reference in New Issue
Block a user