mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-21 07:08:45 +05:00
Replacing CGREvent with *CGRevent when inherited for ThresholdService
This commit is contained in:
committed by
Dan Christian Bogos
parent
6ebdb4bbdf
commit
14ebcb3812
@@ -535,7 +535,7 @@ func (ub *Account) debitCreditBalance(cd *CallDescriptor, count bool, dryRun boo
|
||||
//send default balance to thresholdS to be processed
|
||||
acntTnt := utils.NewTenantID(ub.ID)
|
||||
thEv := &ArgsProcessEvent{
|
||||
CGREvent: utils.CGREvent{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: acntTnt.Tenant,
|
||||
ID: utils.GenUUID(),
|
||||
Event: map[string]interface{}{
|
||||
@@ -1106,7 +1106,7 @@ func (acnt *Account) Publish() {
|
||||
if thresholdS != nil {
|
||||
var tIDs []string
|
||||
if err := thresholdS.Call(utils.ThresholdSv1ProcessEvent,
|
||||
&ArgsProcessEvent{CGREvent: cgrEv}, &tIDs); err != nil &&
|
||||
&ArgsProcessEvent{CGREvent: &cgrEv}, &tIDs); err != nil &&
|
||||
err.Error() != utils.ErrNotFound.Error() {
|
||||
utils.Logger.Warning(
|
||||
fmt.Sprintf("<AccountS> error: %s processing account event %+v with ThresholdS.", err.Error(), cgrEv))
|
||||
|
||||
@@ -715,7 +715,7 @@ func (b *Balance) Publish() {
|
||||
}
|
||||
if thresholdS != nil {
|
||||
var tIDs []string
|
||||
if err := thresholdS.Call(utils.ThresholdSv1ProcessEvent, &ArgsProcessEvent{CGREvent: cgrEv}, &tIDs); err != nil &&
|
||||
if err := thresholdS.Call(utils.ThresholdSv1ProcessEvent, &ArgsProcessEvent{CGREvent: &cgrEv}, &tIDs); err != nil &&
|
||||
err.Error() != utils.ErrNotFound.Error() {
|
||||
utils.Logger.Warning(
|
||||
fmt.Sprintf("<AccountS> error: %s processing balance event %+v with ThresholdS.",
|
||||
@@ -807,7 +807,7 @@ func (bc Balances) SaveDirtyBalances(acc *Account) {
|
||||
}
|
||||
acntTnt := utils.NewTenantID(b.account.ID)
|
||||
thEv := &ArgsProcessEvent{
|
||||
CGREvent: utils.CGREvent{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: acntTnt.Tenant,
|
||||
ID: utils.GenUUID(),
|
||||
Event: map[string]interface{}{
|
||||
@@ -838,7 +838,7 @@ func (bc Balances) SaveDirtyBalances(acc *Account) {
|
||||
for _, acnt := range savedAccounts {
|
||||
acntTnt := utils.NewTenantID(acnt.ID)
|
||||
thEv := &ArgsProcessEvent{
|
||||
CGREvent: utils.CGREvent{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: acntTnt.Tenant,
|
||||
ID: utils.GenUUID(),
|
||||
Event: map[string]interface{}{
|
||||
|
||||
@@ -348,7 +348,7 @@ func (cdrS *CDRServer) attrSProcessEvent(cgrEv *utils.CGREventWithArgDispatcher)
|
||||
// thdSProcessEvent will send the event to ThresholdS if the connection is configured
|
||||
func (cdrS *CDRServer) thdSProcessEvent(cgrEv *utils.CGREventWithArgDispatcher) {
|
||||
var tIDs []string
|
||||
thArgs := &ArgsProcessEvent{CGREvent: *(cgrEv.CGREvent)}
|
||||
thArgs := &ArgsProcessEvent{CGREvent: cgrEv.CGREvent}
|
||||
if cgrEv.ArgDispatcher != nil {
|
||||
thArgs.ArgDispatcher = cgrEv.ArgDispatcher
|
||||
}
|
||||
|
||||
@@ -417,7 +417,7 @@ func (rS *ResourceService) processThresholds(r *Resource, argDispatcher *utils.A
|
||||
thIDs = r.rPrf.ThresholdIDs
|
||||
}
|
||||
thEv := &ArgsProcessEvent{ThresholdIDs: thIDs,
|
||||
CGREvent: utils.CGREvent{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: r.Tenant,
|
||||
ID: utils.GenUUID(),
|
||||
Event: map[string]interface{}{
|
||||
|
||||
@@ -276,7 +276,7 @@ func (sS *StatService) processEvent(args *StatsArgsProcessEvent) (statQueueIDs [
|
||||
}
|
||||
thEv := &ArgsProcessEvent{
|
||||
ThresholdIDs: thIDs,
|
||||
CGREvent: utils.CGREvent{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: sq.Tenant,
|
||||
ID: utils.GenUUID(),
|
||||
Event: map[string]interface{}{
|
||||
|
||||
@@ -278,7 +278,7 @@ func (tS *ThresholdService) matchingThresholdsForEvent(args *ArgsProcessEvent) (
|
||||
|
||||
type ArgsProcessEvent struct {
|
||||
ThresholdIDs []string
|
||||
utils.CGREvent
|
||||
*utils.CGREvent
|
||||
*utils.ArgDispatcher
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ func (tS *ThresholdService) processEvent(args *ArgsProcessEvent) (thresholdsIDs
|
||||
func (tS *ThresholdService) V1ProcessEvent(args *ArgsProcessEvent, reply *[]string) (err error) {
|
||||
if missing := utils.MissingStructFields(args, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing
|
||||
return utils.NewErrMandatoryIeMissing(missing...)
|
||||
} else if args.CGREvent.Event == nil {
|
||||
} else if args.CGREvent == nil || args.CGREvent.Event == nil {
|
||||
return utils.NewErrMandatoryIeMissing("Event")
|
||||
}
|
||||
if ids, err := tS.processEvent(args); err != nil {
|
||||
@@ -357,7 +357,7 @@ func (tS *ThresholdService) V1ProcessEvent(args *ArgsProcessEvent, reply *[]stri
|
||||
func (tS *ThresholdService) V1GetThresholdsForEvent(args *ArgsProcessEvent, reply *Thresholds) (err error) {
|
||||
if missing := utils.MissingStructFields(args, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing
|
||||
return utils.NewErrMandatoryIeMissing(missing...)
|
||||
} else if args.CGREvent.Event == nil {
|
||||
} else if args.CGREvent == nil || args.CGREvent.Event == nil {
|
||||
return utils.NewErrMandatoryIeMissing("Event")
|
||||
}
|
||||
var ts Thresholds
|
||||
|
||||
@@ -91,7 +91,7 @@ var (
|
||||
}
|
||||
argsGetThresholds = []*ArgsProcessEvent{
|
||||
{
|
||||
CGREvent: utils.CGREvent{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Ev1",
|
||||
Event: map[string]interface{}{
|
||||
@@ -101,7 +101,7 @@ var (
|
||||
},
|
||||
},
|
||||
{
|
||||
CGREvent: utils.CGREvent{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Ev1",
|
||||
Event: map[string]interface{}{
|
||||
@@ -111,7 +111,7 @@ var (
|
||||
},
|
||||
},
|
||||
{
|
||||
CGREvent: utils.CGREvent{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Ev1",
|
||||
Event: map[string]interface{}{
|
||||
|
||||
Reference in New Issue
Block a user