From e29541f5b2662096de7eee329bdade94e5a382a2 Mon Sep 17 00:00:00 2001 From: DanB Date: Sun, 10 May 2020 21:30:38 +0200 Subject: [PATCH] EENoLksCfg for a configuration without locks --- config/config.go | 7 +++++++ ees/ees.go | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index b179e800a..1e5b44ae2 100755 --- a/config/config.go +++ b/config/config.go @@ -980,6 +980,13 @@ func (cfg *CGRConfig) ERsCfg() *ERsCfg { // EEsCfg reads the EventExporter configuration func (cfg *CGRConfig) EEsCfg() *EEsCfg { + cfg.lks[EEsJson].RLock() + defer cfg.lks[EEsJson].RUnlock() + return cfg.eesCfg +} + +// EEsCfg reads the EventExporter configuration +func (cfg *CGRConfig) EEsNoLksCfg() *EEsCfg { return cfg.eesCfg } diff --git a/ees/ees.go b/ees/ees.go index 576b546b3..27eb66fcd 100644 --- a/ees/ees.go +++ b/ees/ees.go @@ -113,7 +113,7 @@ func (eeS *EventExporterS) attrSProcessEvent(cgrEv *utils.CGREventWithOpts, attr ArgDispatcher: cgrEv.ArgDispatcher, } if err = eeS.connMgr.Call( - eeS.cfg.EEsCfg().AttributeSConns, nil, + eeS.cfg.EEsNoLksCfg().AttributeSConns, nil, utils.AttributeSv1ProcessEvent, attrArgs, &rplyEv); err == nil && len(rplyEv.AlteredFields) != 0 { cgrEv.CGREvent = rplyEv.CGREvent @@ -132,7 +132,7 @@ func (eeS *EventExporterS) V1ProcessEvent(cgrEv *utils.CGREventWithOpts, rply *s var wg sync.WaitGroup var withErr bool - for cfgIdx, eeCfg := range eeS.cfg.EEsCfg().Exporters { + for cfgIdx, eeCfg := range eeS.cfg.EEsNoLksCfg().Exporters { if len(eeCfg.Filters) != 0 { cgrDp := config.NewNavigableMap(map[string]interface{}{