mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Add utils.ReflectFuncLocation, remove debug for account locks
This commit is contained in:
@@ -118,7 +118,6 @@ func (self *ApierV1) AddBalance(attr *AttrAddBalance, reply *string) error {
|
||||
return err
|
||||
}
|
||||
tag := fmt.Sprintf("%s:%s:%s", attr.Direction, attr.Tenant, attr.Account)
|
||||
engine.Logger.Debug("Add balance before getAccount")
|
||||
if _, err := self.AccountDb.GetAccount(tag); err != nil {
|
||||
// create user balance if not exists
|
||||
account := &engine.Account{
|
||||
@@ -129,7 +128,6 @@ func (self *ApierV1) AddBalance(attr *AttrAddBalance, reply *string) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
engine.Logger.Debug("Add balance after getAccount")
|
||||
at := &engine.ActionTiming{
|
||||
AccountIds: []string{tag},
|
||||
}
|
||||
@@ -143,7 +141,6 @@ func (self *ApierV1) AddBalance(attr *AttrAddBalance, reply *string) error {
|
||||
if attr.Overwrite {
|
||||
aType = engine.DEBIT_RESET
|
||||
}
|
||||
engine.Logger.Debug("Add balance before SetActions")
|
||||
at.SetActions(engine.Actions{
|
||||
&engine.Action{
|
||||
ActionType: aType,
|
||||
@@ -160,12 +157,10 @@ func (self *ApierV1) AddBalance(attr *AttrAddBalance, reply *string) error {
|
||||
},
|
||||
},
|
||||
})
|
||||
engine.Logger.Debug("Add balance before at.Execute")
|
||||
if err := at.Execute(); err != nil {
|
||||
*reply = err.Error()
|
||||
return err
|
||||
}
|
||||
engine.Logger.Debug("AddBalance done!")
|
||||
*reply = OK
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -165,9 +165,6 @@ func (fsev FSEvent) GetReqType(fieldName string) string {
|
||||
return utils.FirstNonEmpty(fsev[fieldName], fsev[REQTYPE], config.CgrConfig().DefaultReqType)
|
||||
}
|
||||
func (fsev FSEvent) MissingParameter() bool {
|
||||
fmt.Printf("Uuid: <%s>, Direction: <%s>, Account: <%s>, Subject: <%s>, Destination: <%s>, Category: <%s>, Tenant: <%s>, CallDestNr: %s\n", fsev.GetUUID(),
|
||||
fsev.GetDirection(utils.META_DEFAULT), fsev.GetAccount(utils.META_DEFAULT), fsev.GetSubject(utils.META_DEFAULT), fsev.GetDestination(utils.META_DEFAULT),
|
||||
fsev.GetCategory(utils.META_DEFAULT), fsev.GetTenant(utils.META_DEFAULT), fsev.GetCallDestNr(utils.META_DEFAULT))
|
||||
return strings.TrimSpace(fsev.GetDirection(utils.META_DEFAULT)) == "" ||
|
||||
strings.TrimSpace(fsev.GetSubject(utils.META_DEFAULT)) == "" ||
|
||||
strings.TrimSpace(fsev.GetAccount(utils.META_DEFAULT)) == "" ||
|
||||
|
||||
@@ -34,7 +34,9 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -359,3 +361,9 @@ func StringSlicePointer(slc []string) *[]string {
|
||||
func Float64SlicePointer(slc []float64) *[]float64 {
|
||||
return &slc
|
||||
}
|
||||
|
||||
func ReflectFuncLocation(handler interface{}) (file string, line int) {
|
||||
f := runtime.FuncForPC(reflect.ValueOf(handler).Pointer())
|
||||
entry := f.Entry()
|
||||
return f.FileLine(entry)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user