Made ThresholdSv1ProcessEvent run in go routine for Account and Balance publish action

This commit is contained in:
Tripon Alexandru-Ionut
2019-06-12 17:05:41 +03:00
committed by Dan Christian Bogos
parent 64ce90cf3f
commit c17b4c08a7
2 changed files with 20 additions and 16 deletions

View File

@@ -1093,8 +1093,8 @@ func (acnt *Account) Publish() {
utils.AllowNegative: acnt.AllowNegative,
utils.Disabled: acnt.Disabled}}
if statS != nil {
var reply []string
go func() {
var reply []string
if err := statS.Call(utils.StatSv1ProcessEvent, &StatsArgsProcessEvent{CGREvent: cgrEv}, &reply); err != nil &&
err.Error() != utils.ErrNotFound.Error() {
utils.Logger.Warning(
@@ -1104,13 +1104,15 @@ func (acnt *Account) Publish() {
}()
}
if thresholdS != nil {
var tIDs []string
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 account event %+v with ThresholdS.", err.Error(), cgrEv))
}
go func() {
var tIDs []string
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 account event %+v with ThresholdS.", err.Error(), cgrEv))
}
}()
}
}

View File

@@ -703,8 +703,8 @@ func (b *Balance) Publish() {
cgrEv.Event[utils.ExpiryTime] = b.ExpirationDate.Format(time.RFC3339)
}
if statS != nil {
var reply []string
go func() {
var reply []string
if err := statS.Call(utils.StatSv1ProcessEvent, &StatsArgsProcessEvent{CGREvent: cgrEv}, &reply); err != nil &&
err.Error() != utils.ErrNotFound.Error() {
utils.Logger.Warning(
@@ -714,13 +714,15 @@ func (b *Balance) Publish() {
}()
}
if thresholdS != nil {
var tIDs []string
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.",
err.Error(), cgrEv))
}
go func() {
var tIDs []string
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.",
err.Error(), cgrEv))
}
}()
}
}