From 8f3a96e3e4885abeec739327c44f1af4bdde0742 Mon Sep 17 00:00:00 2001 From: TeoV Date: Fri, 21 Sep 2018 03:18:36 -0400 Subject: [PATCH] Update account and balance Publish method --- docs/installation.rst | 2 +- engine/account.go | 11 +++++++++-- engine/balances.go | 11 +++++++++-- sessions/sessions.go | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/docs/installation.rst b/docs/installation.rst index 334f936d3..a1cd43fea 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -33,7 +33,7 @@ In a nutshell all the dependencies are installed and used from a folder named *v First we have to setup the GO Lang to our OS. Feel free to download the latest GO binary release from https://golang.org/dl/ -In this Tutorial we are going to install Go 1.11.0. +In this Tutorial we are going to install Go 1.11 :: diff --git a/engine/account.go b/engine/account.go index 4864c586c..6d5aca1bf 100644 --- a/engine/account.go +++ b/engine/account.go @@ -1085,12 +1085,19 @@ func (acnt *Account) Publish() { utils.Account: acntTnt.ID, utils.AllowNegative: acnt.AllowNegative, utils.Disabled: acnt.Disabled}} - var tIDs []string if statS != nil { var reply []string - go statS.Call(utils.StatSv1ProcessEvent, &StatsArgsProcessEvent{CGREvent: cgrEv}, &reply) + go func() { + if err := statS.Call(utils.StatSv1ProcessEvent, &StatsArgsProcessEvent{CGREvent: cgrEv}, &reply); err != nil && + err.Error() != utils.ErrNotFound.Error() { + utils.Logger.Warning( + fmt.Sprintf(" error: %s processing balance event %+v with StatS.", + err.Error(), cgrEv)) + } + }() } if thresholdS != nil { + var tIDs []string if err := thresholdS.Call(utils.ThresholdSv1ProcessEvent, &ArgsProcessEvent{CGREvent: cgrEv}, &tIDs); err != nil && err.Error() != utils.ErrNotFound.Error() { diff --git a/engine/balances.go b/engine/balances.go index 32ab7eaa6..1aa261945 100644 --- a/engine/balances.go +++ b/engine/balances.go @@ -715,10 +715,17 @@ func (b *Balance) Publish() { } if statS != nil { var reply []string - go statS.Call(utils.StatSv1ProcessEvent, &StatsArgsProcessEvent{CGREvent: cgrEv}, &reply) + go func() { + if err := statS.Call(utils.StatSv1ProcessEvent, &StatsArgsProcessEvent{CGREvent: cgrEv}, &reply); err != nil && + err.Error() != utils.ErrNotFound.Error() { + utils.Logger.Warning( + fmt.Sprintf(" error: %s processing balance event %+v with StatS.", + err.Error(), cgrEv)) + } + }() } - var tIDs []string 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( diff --git a/sessions/sessions.go b/sessions/sessions.go index f11f5caab..fb924438b 100644 --- a/sessions/sessions.go +++ b/sessions/sessions.go @@ -281,7 +281,7 @@ func (smg *SMGeneric) ttlTerminate(s *SMGSession, tmtr *smgSessionTerminator) { cdr.Usage = s.TotalUsage var reply string cgrEv := &utils.CGREvent{ - Tenant: s.EventStart.GetStringIgnoreErrors(utils.Tenant), + Tenant: s.Tenant, ID: utils.UUIDSha1Prefix(), Event: cdr.AsMapStringIface(), }