Do not add supplier to LCR if we cannot calculate his cost, removing some unused debug

This commit is contained in:
DanB
2015-05-02 10:55:19 +02:00
parent cb442c3a9b
commit c38c25d39c
7 changed files with 6 additions and 13 deletions

View File

@@ -166,7 +166,6 @@ func (self *ApierV1) AddBalance(attr *AttrAddBalance, reply *string) error {
}
func (self *ApierV1) ExecuteAction(attr *utils.AttrExecuteAction, reply *string) error {
engine.Logger.Debug(fmt.Sprintf("Executing action, attrs: %+v", attr))
tag := fmt.Sprintf("%s:%s:%s", attr.Direction, attr.Tenant, attr.Account)
at := &engine.ActionTiming{
AccountIds: []string{tag},

View File

@@ -235,7 +235,6 @@ func cdrLogAction(acc *Account, sq *StatsQueueTriggered, a *Action, acs Actions)
if cdrStorage == nil { // Only save if the cdrStorage is defined
continue
}
Logger.Debug(fmt.Sprintf("SetCdr: %+v\n", cdr))
if err := cdrStorage.SetCdr(cdr); err != nil {
return err
}

View File

@@ -887,10 +887,12 @@ func (cd *CallDescriptor) GetLCR(stats StatsInterface) (*LCRCost, error) {
//log.Printf("CC: %+v", cc)
supplier = utils.ConcatenatedKey(lcrCD.Direction, lcrCD.Tenant, lcrCD.Category, lcrCD.Subject)
if err != nil || cc == nil {
lcrCost.SupplierCosts = append(lcrCost.SupplierCosts, &LCRSupplierCost{
Supplier: supplier,
Error: err,
})
//lcrCost.SupplierCosts = append(lcrCost.SupplierCosts, &LCRSupplierCost{
// Supplier: supplier,
// Error: err,
//})
Logger.Warning(fmt.Sprintf("LCR_WARNING: Ignoring supplier: %s, cannot calculate cost, error: %v", err))
continue
} else {
supplCost := &LCRSupplierCost{
Supplier: supplier,

View File

@@ -184,7 +184,6 @@ func TestImportToStorDb(t *testing.T) {
if tpids, err := storDb.GetTPIds(); err != nil {
t.Error("Error when querying storDb for imported data: ", err)
} else if len(tpids) != 1 || tpids[0] != TEST_SQL {
fmt.Printf("len(tpids): %d, tpids[0]=%s, tpids: %+v\n", len(tpids), tpids[0], tpids)
t.Errorf("Data in storDb is different than expected %v", tpids)
}
}

View File

@@ -134,7 +134,6 @@ func TestMySQLSetGetTPDestinationRates(t *testing.T) {
if drs, err := mysqlDb.GetTpDestinationRates(TEST_SQL, DR_ID, nil); err != nil {
t.Error(err.Error())
} else if !reflect.DeepEqual(eDrs, drs[DR_ID]) {
fmt.Printf("Received: %+v\n", drs[DR_ID].DestinationRates[0])
t.Errorf("Expecting: %+v, received: %+v", eDrs, drs[DR_ID])
}
}

View File

@@ -116,9 +116,6 @@ func TestPSQLSetGetTPRates(t *testing.T) {
if rts, err := psqlDb.GetTpRates(TEST_SQL, RT_ID); err != nil {
t.Error(err.Error())
} else if len(expectedTPRate.RateSlots) != len(rts[RT_ID].RateSlots) {
for _, slot := range rts[RT_ID].RateSlots {
fmt.Printf("Rates slot receievd: %+v\n", slot)
}
t.Errorf("Expecting: %+v, received: %+v", expectedTPRate, rts[RT_ID])
}
}
@@ -137,7 +134,6 @@ func TestPSQLSetGetTPDestinationRates(t *testing.T) {
if drs, err := psqlDb.GetTpDestinationRates(TEST_SQL, DR_ID, nil); err != nil {
t.Error(err.Error())
} else if !reflect.DeepEqual(eDrs, drs[DR_ID]) {
fmt.Printf("Received: %+v\n", drs[DR_ID].DestinationRates[0])
t.Errorf("Expecting: %+v, received: %+v", eDrs, drs[DR_ID])
}
}

View File

@@ -47,7 +47,6 @@ func (s *Scheduler) Loop() {
a0 := s.queue[0]
now := time.Now()
if a0.GetNextStartTime(now).Equal(now) || a0.GetNextStartTime(now).Before(now) {
engine.Logger.Debug(fmt.Sprintf("%v - %v", a0.Id, a0.Timing))
go a0.Execute()
// if after execute the next start time is in the past then
// do not add it to the queue