mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Added concurent requests for ees
This commit is contained in:
committed by
Dan Christian Bogos
parent
f1796317a0
commit
24b09329be
@@ -36,6 +36,7 @@ func NewHTTPjsonMapEE(cgrCfg *config.CGRConfig, cfgIdx int, filterS *engine.Filt
|
||||
cfgIdx: cfgIdx,
|
||||
filterS: filterS,
|
||||
dc: dc,
|
||||
reqs: newConcReq(cgrCfg.EEsCfg().Exporters[cfgIdx].ConcurrentRequests),
|
||||
}
|
||||
|
||||
pstrJSON.pstr, err = engine.NewHTTPPoster(cgrCfg.GeneralCfg().ReplyTimeout,
|
||||
@@ -53,6 +54,7 @@ type HTTPjsonMapEE struct {
|
||||
filterS *engine.FilterS
|
||||
pstr *engine.HTTPPoster
|
||||
dc *utils.SafeMapStorage
|
||||
reqs *concReq
|
||||
}
|
||||
|
||||
// ID returns the identificator of this exporter
|
||||
@@ -65,9 +67,11 @@ func (httpEE *HTTPjsonMapEE) OnEvicted(string, interface{}) {}
|
||||
|
||||
// ExportEvent implements EventExporter
|
||||
func (httpEE *HTTPjsonMapEE) ExportEvent(cgrEv *utils.CGREvent) (err error) {
|
||||
httpEE.reqs.get()
|
||||
defer func() {
|
||||
updateEEMetrics(httpEE.dc, cgrEv.ID, cgrEv.Event, err != nil, utils.FirstNonEmpty(httpEE.cgrCfg.EEsCfg().Exporters[httpEE.cfgIdx].Timezone,
|
||||
httpEE.cgrCfg.GeneralCfg().DefaultTimezone))
|
||||
httpEE.reqs.done()
|
||||
}()
|
||||
httpEE.dc.Lock()
|
||||
httpEE.dc.MapStorage[utils.NumberOfEvents] = httpEE.dc.MapStorage[utils.NumberOfEvents].(int64) + 1
|
||||
|
||||
Reference in New Issue
Block a user